Skip to content

Commit

Permalink
Fix select views when Android databases are upgraded.
Browse files Browse the repository at this point in the history
The table sqlite_master was renamed to sqlite_schema in SQLite version 3.33.0. Android SDK33 and lower has a prior version of SQLite, so we need to use the table name sqlite_master (which is still recognized for backwards compatibility by SQLite on newer versions).
  • Loading branch information
mikedawson committed Jul 14, 2024
1 parent bf6a7bc commit ff7408a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ plugins {


group 'com.github.UstadMobile.door'
version '0.79.9'
version '0.79.11'

ext.localProperties = new Properties()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package com.ustadmobile.door.triggers

/**
* Note: sqlite_master was renamed to sqlite_schema in SQLite 3.33.0 . Many Android versions ship with a lower
* version than that as per:
*
* https://developer.android.com/reference/android/database/sqlite/package-summary.html
*
*/
object TriggerConstants {

const val SQLITE_SELECT_TRIGGER_NAMES = """
Expand All @@ -11,9 +18,9 @@ object TriggerConstants {

const val SQLITE_SELECT_VIEW_NAMES = """
SELECT name
FROM sqlite_schema
WHERE type = 'view'
AND name LIKE ?
FROM sqlite_master
WHERE type = 'view'
AND name LIKE ?
"""

}

0 comments on commit ff7408a

Please sign in to comment.