commit 23/09/2025
This commit is contained in:
@@ -1737,7 +1737,7 @@ class MariaDB(
|
||||
fun Add_BroadcastZones(broadcastZones: BroadcastZones): Boolean {
|
||||
try {
|
||||
val statement =
|
||||
connection?.prepareStatement("INSERT INTO broadcast_zones (description, SoundChannel, Box, Relay) VALUES (?, ?, ?, ?)")
|
||||
connection?.prepareStatement("INSERT INTO broadcastzones (description, SoundChannel, Box, Relay) VALUES (?, ?, ?, ?)")
|
||||
statement?.setString(1, broadcastZones.description)
|
||||
statement?.setString(2, broadcastZones.SoundChannel)
|
||||
statement?.setString(3, broadcastZones.Box)
|
||||
@@ -1766,7 +1766,7 @@ class MariaDB(
|
||||
if (connection != null) {
|
||||
connection!!.autoCommit = false
|
||||
val sql =
|
||||
"INSERT INTO broadcast_zones (description, SoundChannel, Box, Relay) VALUES (?, ?, ?, ?)"
|
||||
"INSERT INTO broadcastzones (description, SoundChannel, Box, Relay) VALUES (?, ?, ?, ?)"
|
||||
val statement = connection!!.prepareStatement(sql)
|
||||
for (bz in broadcastZonesList) {
|
||||
statement.setString(1, bz.description)
|
||||
@@ -1797,7 +1797,7 @@ class MariaDB(
|
||||
fun Update_BroadcastZones_by_index(index: UInt, broadcastZones: BroadcastZones): Boolean {
|
||||
try {
|
||||
val statement =
|
||||
connection?.prepareStatement("UPDATE broadcast_zones SET description = ?, SoundChannel = ?, Box = ?, Relay = ? WHERE `index` = ?")
|
||||
connection?.prepareStatement("UPDATE broadcastzones SET description = ?, SoundChannel = ?, Box = ?, Relay = ? WHERE `index` = ?")
|
||||
statement?.setString(1, broadcastZones.description)
|
||||
statement?.setString(2, broadcastZones.SoundChannel)
|
||||
statement?.setString(3, broadcastZones.Box)
|
||||
@@ -1823,7 +1823,7 @@ class MariaDB(
|
||||
*/
|
||||
fun Delete_BroadcastZones_by_index(index: UInt): Boolean {
|
||||
try {
|
||||
val statement = connection?.prepareStatement("DELETE FROM broadcast_zones WHERE `index` = ?")
|
||||
val statement = connection?.prepareStatement("DELETE FROM broadcastzones WHERE `index` = ?")
|
||||
statement?.setLong(1, index.toLong())
|
||||
val rowsAffected = statement?.executeUpdate()
|
||||
if (rowsAffected != null && rowsAffected > 0) {
|
||||
@@ -1846,11 +1846,11 @@ class MariaDB(
|
||||
try {
|
||||
val statement = connection?.createStatement()
|
||||
// use a temporary table to reorder the index
|
||||
statement?.executeUpdate("CREATE TABLE IF NOT EXISTS temp_broadcast_zones LIKE broadcast_zones")
|
||||
statement?.executeUpdate("INSERT INTO temp_broadcast_zones (description, SoundChannel, Box, Relay) SELECT description, SoundChannel, Box, Relay FROM broadcast_zones ORDER BY description ASC")
|
||||
statement?.executeUpdate("TRUNCATE TABLE broadcast_zones")
|
||||
statement?.executeUpdate("INSERT INTO broadcast_zones (description, SoundChannel, Box, Relay) SELECT description, SoundChannel, Box, Relay FROM temp_broadcast_zones")
|
||||
statement?.executeUpdate("DROP TABLE temp_broadcast_zones")
|
||||
statement?.executeUpdate("CREATE TABLE IF NOT EXISTS temp_broadcastzones LIKE broadcastzones")
|
||||
statement?.executeUpdate("INSERT INTO temp_broadcastzones (description, SoundChannel, Box, Relay) SELECT description, SoundChannel, Box, Relay FROM broadcastzones ORDER BY description ASC")
|
||||
statement?.executeUpdate("TRUNCATE TABLE broadcastzones")
|
||||
statement?.executeUpdate("INSERT INTO broadcastzones (description, SoundChannel, Box, Relay) SELECT description, SoundChannel, Box, Relay FROM temp_broadcastzones")
|
||||
statement?.executeUpdate("DROP TABLE temp_broadcastzones")
|
||||
Logger.info("broadcast_zones table resorted by description" as Any)
|
||||
// reload the local list
|
||||
GetBroadcastZones()
|
||||
@@ -1868,7 +1868,7 @@ class MariaDB(
|
||||
try {
|
||||
val statement = connection?.createStatement()
|
||||
// use TRUNCATE to reset auto increment index
|
||||
statement?.executeUpdate("TRUNCATE TABLE broadcast_zones")
|
||||
statement?.executeUpdate("TRUNCATE TABLE broadcastzones")
|
||||
Logger.info("Broadcast zones table cleared" as Any)
|
||||
return true
|
||||
} catch (e: Exception) {
|
||||
@@ -1884,7 +1884,7 @@ class MariaDB(
|
||||
fun Export_BroadcastZones_XLSX(): XSSFWorkbook? {
|
||||
try {
|
||||
val statement = connection?.createStatement()
|
||||
val resultSet = statement?.executeQuery("SELECT * FROM broadcast_zones")
|
||||
val resultSet = statement?.executeQuery("SELECT * FROM broadcastzones")
|
||||
val workbook = XSSFWorkbook()
|
||||
val sheet = workbook.createSheet("BroadcastZones")
|
||||
val headerRow = sheet.createRow(0)
|
||||
|
||||
Reference in New Issue
Block a user