|
|
@ -79,6 +79,7 @@ class SqliteManager(private val chunkmaster: Chunkmaster) {
|
|
|
|
fun executeStatement(sql: String, values: HashMap<Int, Any>, callback: ((ResultSet) -> Unit)?) {
|
|
|
|
fun executeStatement(sql: String, values: HashMap<Int, Any>, callback: ((ResultSet) -> Unit)?) {
|
|
|
|
val connection = getConnection()
|
|
|
|
val connection = getConnection()
|
|
|
|
if (connection != null) {
|
|
|
|
if (connection != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
val statement = connection.prepareStatement(sql)
|
|
|
|
val statement = connection.prepareStatement(sql)
|
|
|
|
for (parameterValue in values) {
|
|
|
|
for (parameterValue in values) {
|
|
|
|
statement.setObject(parameterValue.key, parameterValue.value)
|
|
|
|
statement.setObject(parameterValue.key, parameterValue.value)
|
|
|
@ -89,7 +90,12 @@ class SqliteManager(private val chunkmaster: Chunkmaster) {
|
|
|
|
callback(res)
|
|
|
|
callback(res)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
statement.close()
|
|
|
|
statement.close()
|
|
|
|
|
|
|
|
} catch (e: Exception) {
|
|
|
|
|
|
|
|
chunkmaster.logger.severe("An error occured on sql $sql. ${e.message}")
|
|
|
|
|
|
|
|
chunkmaster.logger.info(ExceptionUtils.getStackTrace(e))
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
connection.close()
|
|
|
|
connection.close()
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
chunkmaster.logger.severe("Could not execute sql $sql. No database connection established.")
|
|
|
|
chunkmaster.logger.severe("Could not execute sql $sql. No database connection established.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|