Database test fix

pull/2020/head
Dharanish 1 year ago
parent 4e70c38a7a
commit e65ed032a9

@ -24,7 +24,6 @@ import java.sql.Connection
import java.sql.PreparedStatement
import java.sql.SQLException
import java.sql.Types
import java.util.ArrayList
class JdbcDatabase(private val connection: Connection) : Database {
private var transactionSuccessful = false
@ -51,6 +50,14 @@ class JdbcDatabase(private val connection: Connection) : Database {
valuesStr.add(value.toString())
}
valuesStr.addAll(listOf(*params))
if (tableName == "habits") {
val groupIdx = fields.indexOf("group_id=?")
if (valuesStr[groupIdx] == "null") {
valuesStr.removeAt(groupIdx)
fields.removeAt(groupIdx)
}
}
val query = String.format(
"update %s set %s where %s",
tableName,

Loading…
Cancel
Save