commit 02/09/2025

This commit is contained in:
2025-09-02 12:34:15 +07:00
parent 7100cf826d
commit ea1defa78e
5 changed files with 224 additions and 45 deletions

View File

@@ -217,7 +217,7 @@ class MariaDB (
/**
* Reloads the ScheduleBank list from the database.
*/
private fun Reload_Schedulebank() {
fun Reload_Schedulebank() {
SchedulebankList.clear()
try {
val statement = connection?.createStatement()
@@ -266,22 +266,24 @@ class MariaDB (
/**
* Clears all entries from the schedulebank table in the database and the local list.
*/
fun Clear_Schedulebank() {
fun Clear_Schedulebank() : Boolean {
try {
val statement = connection?.createStatement()
// use TRUNCATE to reset auto increment index
statement?.executeUpdate("TRUNCATE TABLE schedulebank")
Logger.info("Schedulebank table cleared" as Any)
SchedulebankList.clear()
return true
} catch (e : Exception) {
Logger.error("Error clearing schedulebank table: ${e.message}" as Any)
}
return false
}
/**
* Reloads the language link list from the database.
*/
private fun Reload_LanguageLink() {
fun Reload_LanguageLink() {
LanguageLinkList.clear()
try {
val statement = connection?.createStatement()
@@ -324,22 +326,24 @@ class MariaDB (
/**
* Clears all entries from the language link table in the database and the local list.
*/
fun Clear_LanguageLink() {
fun Clear_LanguageLink() : Boolean {
try {
val statement = connection?.createStatement()
// use TRUNCATE to reset auto increment index
statement?.executeUpdate("TRUNCATE TABLE languagelink")
Logger.info("LanguageLink table cleared" as Any)
LanguageLinkList.clear()
return true
} catch (e : Exception) {
Logger.error("Error clearing LanguageLink table: ${e.message}" as Any)
}
return false
}
/**
* Reloads the soundbank list from the database.
*/
private fun Reload_Soundbank() {
fun Reload_Soundbank() {
SoundbankList.clear()
try {
@@ -387,22 +391,24 @@ class MariaDB (
/**
* Clears all entries from the soundbank table in the database and the local list.
*/
fun Clear_Soundbank() {
fun Clear_Soundbank() : Boolean{
try {
val statement = connection?.createStatement()
// use TRUNCATE to reset auto increment index
statement?.executeUpdate("TRUNCATE TABLE soundbank")
Logger.info("Soundbank table cleared" as Any)
SoundbankList.clear()
return true
} catch (e : Exception) {
Logger.error("Error clearing soundbank table: ${e.message}" as Any)
}
return false
}
/**
* Reloads the messagebank list from the database.
*/
private fun Reload_Messagebank() {
fun Reload_Messagebank() {
MessagebankList.clear()
try {
val statement = connection?.createStatement()
@@ -450,16 +456,18 @@ class MariaDB (
/**
* Clears all entries from the messagebank table in the database and the local list.
*/
fun Clear_Messagebank() {
fun Clear_Messagebank() : Boolean{
try {
val statement = connection?.createStatement()
// use TRUNCATE to reset auto increment index
statement?.executeUpdate("TRUNCATE TABLE messagebank")
Logger.info("Messagebank table cleared" as Any)
MessagebankList.clear()
return true
} catch (e : Exception) {
Logger.error("Error clearing messagebank table: ${e.message}" as Any)
}
return false
}
/**
@@ -516,15 +524,17 @@ class MariaDB (
/**
* Clears all entries from the queue_table in the database.
*/
fun Clear_Queue_Table() {
fun Clear_Queue_Table() : Boolean {
try {
val statement = connection?.createStatement()
// use TRUNCATE to reset auto increment index
statement?.executeUpdate("TRUNCATE TABLE queue_table")
Logger.info("Queue table cleared" as Any)
return true
} catch (e : Exception) {
Logger.error("Error clearing queue table: ${e.message}" as Any)
}
return false
}
/**
@@ -578,15 +588,17 @@ class MariaDB (
/**
* Clears all entries from the queue_paging in the database.
*/
fun Clear_Queue_Paging(){
fun Clear_Queue_Paging() : Boolean{
try {
val statement = connection?.createStatement()
// use TRUNCATE to reset auto increment index
statement?.executeUpdate("TRUNCATE TABLE queue_paging")
Logger.info("Queue paging table cleared" as Any)
return true
} catch (e : Exception) {
Logger.error("Error clearing queue paging table: ${e.message}" as Any)
}
return false
}
/**
@@ -639,15 +651,17 @@ class MariaDB (
/**
* Clears all entries from the broadcast_zones in the database.
*/
fun Clear_BroadcastZones() {
fun Clear_BroadcastZones() : Boolean {
try {
val statement = connection?.createStatement()
// use TRUNCATE to reset auto increment index
statement?.executeUpdate("TRUNCATE TABLE broadcast_zones")
Logger.info("Broadcast zones table cleared" as Any)
return true
} catch (e : Exception) {
Logger.error("Error clearing broadcast zones table: ${e.message}" as Any)
}
return false
}
}