-
public final class SQLiteDatabaseExtKt
-
-
Method Summary
Modifier and Type Method Description final static BooleanalterTableIfColumnDoesNotExist(SQLiteDatabase $self, String tableName, String columnName, String alterSql)Check to see if a column in a database exists, if it does not... final static BooleantableExists(SQLiteDatabase $self, String tableName)Check to see if a table in a database exists final static BooleancolumnExists(SQLiteDatabase $self, String tableName, String columnName)Check to see if a column in a database exists final static UnitresetRoom(SQLiteDatabase $self, Integer newVersion)If we make a manual change, then we need to reset room so that it does not fail the validation final static UnitcheckAndFixRoomIdentityHash(SQLiteDatabase $self, Integer expectedVersion, String expectedIdentityHash)If the database should NOT have a migration and is a pre-populated database that should not be managed by Room... final static StringfindRoomIdentityHash(SQLiteDatabase $self)Find the Room Identity Hash Note: if you are not sure if the room_master_table exists, check first with tableExists(database, "room_master_table") -
-
Method Detail
-
alterTableIfColumnDoesNotExist
final static Boolean alterTableIfColumnDoesNotExist(SQLiteDatabase $self, String tableName, String columnName, String alterSql)
Check to see if a column in a database exists, if it does not... alter query will be run
- Parameters:
tableName- table for columnNamecolumnName- column to from tableName to be checkedalterSql- SQL to be run if the column does not exits.
-
tableExists
final static Boolean tableExists(SQLiteDatabase $self, String tableName)
Check to see if a table in a database exists
- Parameters:
tableName- tableName to from database to be checked
-
columnExists
final static Boolean columnExists(SQLiteDatabase $self, String tableName, String columnName)
Check to see if a column in a database exists
- Parameters:
tableName- table for columnNamecolumnName- column to from tableName to be checked
-
resetRoom
final static Unit resetRoom(SQLiteDatabase $self, Integer newVersion)
If we make a manual change, then we need to reset room so that it does not fail the validation
- Parameters:
newVersion- version to be set on database (default to 0)
-
checkAndFixRoomIdentityHash
final static Unit checkAndFixRoomIdentityHash(SQLiteDatabase $self, Integer expectedVersion, String expectedIdentityHash)
If the database should NOT have a migration and is a pre-populated database that should not be managed by Room... make sure Room migration is never needed.
- Parameters:
expectedVersion- SQLite Database version (PRAGMA user_version)expectedIdentityHash- Hash that is expected.
-
findRoomIdentityHash
final static String findRoomIdentityHash(SQLiteDatabase $self)
Find the Room Identity Hash Note: if you are not sure if the room_master_table exists, check first with tableExists(database, "room_master_table")
-
-
-
-