Update more libraries.

This commit is contained in:
Greyson Parrelli
2024-12-20 21:24:45 -05:00
parent 71d7238f3b
commit 31897b4c4b
21 changed files with 926 additions and 108 deletions

View File

@@ -120,7 +120,7 @@ fun SupportSQLiteDatabase.getForeignKeys(): List<ForeignKeyConstraint> {
}
fun SupportSQLiteDatabase.areForeignKeyConstraintsEnabled(): Boolean {
return this.query("PRAGMA foreign_keys", null).use { cursor ->
return this.query("PRAGMA foreign_keys", arrayOf()).use { cursor ->
cursor.moveToFirst() && cursor.getInt(0) != 0
}
}
@@ -508,7 +508,7 @@ class ExistsBuilderPart1(
}
fun run(): Boolean {
return db.query("SELECT EXISTS(SELECT 1 FROM $tableName)", null).use { cursor ->
return db.query("SELECT EXISTS(SELECT 1 FROM $tableName)", arrayOf()).use { cursor ->
cursor.moveToFirst() && cursor.getInt(0) == 1
}
}

View File

@@ -43,7 +43,7 @@ object SqlUtil {
* IMPORTANT: Due to how connection pooling is handled in the app, the only way to have this return useful numbers is to call it within a transaction.
*/
fun getTotalChanges(db: SupportSQLiteDatabase): Long {
return db.query("SELECT total_changes()", null).readToSingleLong()
return db.query("SELECT total_changes()", arrayOf()).readToSingleLong()
}
@JvmStatic
@@ -120,7 +120,7 @@ object SqlUtil {
@JvmStatic
fun isEmpty(db: SupportSQLiteDatabase, table: String): Boolean {
db.query("SELECT COUNT(*) FROM $table", null).use { cursor ->
db.query("SELECT COUNT(*) FROM $table", arrayOf()).use { cursor ->
return if (cursor.moveToFirst()) {
cursor.getInt(0) == 0
} else {
@@ -131,7 +131,7 @@ object SqlUtil {
@JvmStatic
fun columnExists(db: SupportSQLiteDatabase, table: String, column: String): Boolean {
db.query("PRAGMA table_info($table)", null).use { cursor ->
db.query("PRAGMA table_info($table)", arrayOf()).use { cursor ->
val nameColumnIndex = cursor.getColumnIndexOrThrow("name")
while (cursor.moveToNext()) {
val name = cursor.getString(nameColumnIndex)

View File

@@ -31,11 +31,11 @@ private class CapturingSqliteProgram(count: Int) : SupportSQLiteProgram {
args[index - 1] = value.toString()
}
override fun bindString(index: Int, value: String?) {
override fun bindString(index: Int, value: String) {
args[index - 1] = value
}
override fun bindBlob(index: Int, value: ByteArray?) {
override fun bindBlob(index: Int, value: ByteArray) {
throw UnsupportedOperationException()
}