moving another function in Room

This commit is contained in:
tibbi
2018-11-07 20:39:17 +01:00
parent 43896a964a
commit 66821397e9
6 changed files with 75 additions and 72 deletions

View File

@ -78,19 +78,6 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe
mDb.delete(WIDGETS_TABLE_NAME, "$COL_NOTE_ID = $id", null)
}
fun doesNoteTitleExist(title: String): Boolean {
val cols = arrayOf(COL_ID)
val selection = "$COL_TITLE = ? COLLATE NOCASE"
val selectionArgs = arrayOf(title)
var cursor: Cursor? = null
try {
cursor = mDb.query(NOTES_TABLE_NAME, cols, selection, selectionArgs, null, null, null)
return cursor.count == 1
} finally {
cursor?.close()
}
}
fun getWidgets(): ArrayList<Widget> {
val widgets = ArrayList<Widget>()
val cols = arrayOf(COL_WIDGET_ID, COL_NOTE_ID)