Package mil.nga.geopackage.db
Class AndroidSQLiteDatabase
java.lang.Object
mil.nga.geopackage.db.AndroidSQLiteDatabase
- All Implemented Interfaces:
GeoPackageSQLiteDatabase
Android SQLiteDatabase
- Since:
- 3.4.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Begin a transactionvoid
close()
Close the connectionint
Delete from tablevoid
End a transaction as successful and begin a new transactionvoid
End a transaction as successfulvoid
endTransaction
(boolean successful) End a transactionvoid
Execute SQLgetDb()
Get the SQLite database connectionlong
insert
(String table, String nullColumnHack, ContentValues values) Insert into a tablelong
insertOrThrow
(String table, String nullColumnHack, ContentValues values) Insert into a tableboolean
Determine if currently within a transactionquery
(boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) Query the tablequery
(String table, String[] columns, String[] columnsAs, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) Query the tablequery
(String table, String[] columns, String[] columnsAs, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) Query the tablequery
(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) Query the tablequery
(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) Query the tableRaw queryrawQueryWithFactory
(GeoPackageCursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable) Raw query with factoryint
update
(String table, ContentValues values, String whereClause, String[] whereArgs) Update the table
-
Constructor Details
-
AndroidSQLiteDatabase
Constructor- Parameters:
db
- database
-
-
Method Details
-
getDb
Get the SQLite database connection- Returns:
- connection
-
execSQL
Execute SQL- Specified by:
execSQL
in interfaceGeoPackageSQLiteDatabase
- Parameters:
sql
- sql command- Throws:
SQLException
- See Also:
-
beginTransaction
public void beginTransaction()Begin a transaction- Specified by:
beginTransaction
in interfaceGeoPackageSQLiteDatabase
-
endTransaction
public void endTransaction()End a transaction as successful- Specified by:
endTransaction
in interfaceGeoPackageSQLiteDatabase
-
endTransaction
public void endTransaction(boolean successful) End a transaction- Specified by:
endTransaction
in interfaceGeoPackageSQLiteDatabase
- Parameters:
successful
- true to commit, false to rollback
-
endAndBeginTransaction
public void endAndBeginTransaction()End a transaction as successful and begin a new transaction- Specified by:
endAndBeginTransaction
in interfaceGeoPackageSQLiteDatabase
-
inTransaction
public boolean inTransaction()Determine if currently within a transaction- Specified by:
inTransaction
in interfaceGeoPackageSQLiteDatabase
- Returns:
- true if in transaction
-
delete
Delete from table- Specified by:
delete
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namewhereClause
- where clausewhereArgs
- where arguments- Returns:
- deleted rows
- See Also:
-
rawQuery
Raw query- Specified by:
rawQuery
in interfaceGeoPackageSQLiteDatabase
- Parameters:
sql
- sql commandselectionArgs
- selection arguments- Returns:
- cursor
- See Also:
-
rawQueryWithFactory
public Cursor rawQueryWithFactory(GeoPackageCursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable) Raw query with factory- Specified by:
rawQueryWithFactory
in interfaceGeoPackageSQLiteDatabase
- Parameters:
cursorFactory
- cursor factorysql
- sql commandselectionArgs
- selection argumentseditTable
- edit table name- Returns:
- cursor
- See Also:
-
close
public void close()Close the connection- Specified by:
close
in interfaceGeoPackageSQLiteDatabase
- See Also:
-
query
public Cursor query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) Query the table- Specified by:
query
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namecolumns
- columnsselection
- selectionselectionArgs
- selection argumentsgroupBy
- group byhaving
- havingorderBy
- order by- Returns:
- cursor
- See Also:
-
query
public Cursor query(String table, String[] columns, String[] columnsAs, String selection, String[] selectionArgs, String groupBy, String having, String orderBy) Query the table- Specified by:
query
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namecolumns
- columnscolumnsAs
- columns asselection
- selectionselectionArgs
- selection argumentsgroupBy
- group byhaving
- havingorderBy
- order by- Returns:
- cursor
- See Also:
-
query
public Cursor query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) Query the table- Specified by:
query
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namecolumns
- columnsselection
- selectionselectionArgs
- selection argumentsgroupBy
- group byhaving
- havingorderBy
- order bylimit
- limit- Returns:
- cursor
- See Also:
-
query
public Cursor query(String table, String[] columns, String[] columnsAs, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) Query the table- Specified by:
query
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namecolumns
- columnscolumnsAs
- columns asselection
- selectionselectionArgs
- selection argumentsgroupBy
- group byhaving
- havingorderBy
- order bylimit
- limit- Returns:
- cursor
- See Also:
-
query
public Cursor query(boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) Query the table- Specified by:
query
in interfaceGeoPackageSQLiteDatabase
- Parameters:
distinct
- distinct flagtable
- table namecolumns
- columnsselection
- selectionselectionArgs
- selection argumentsgroupBy
- group byhaving
- havingorderBy
- order bylimit
- limit- Returns:
- cursor
- See Also:
-
update
Update the table- Specified by:
update
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namevalues
- content valueswhereClause
- where clausewhereArgs
- where arguments- Returns:
- updated rows
- See Also:
-
insertOrThrow
public long insertOrThrow(String table, String nullColumnHack, ContentValues values) throws SQLException Insert into a table- Specified by:
insertOrThrow
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namenullColumnHack
- null column hackvalues
- content values- Returns:
- row id
- Throws:
SQLException
- See Also:
-
insert
Insert into a table- Specified by:
insert
in interfaceGeoPackageSQLiteDatabase
- Parameters:
table
- table namenullColumnHack
- null column hackvalues
- content values- Returns:
- row id
- See Also:
-