Android Databases
Unit V
Mobile Application Development
By
Michael.K
SQLite
Android SQLite
SQLite classes
SQLiteCursor | A Cursor implementation that exposes results from a query on a SQLiteDatabase. |
SQLiteDatabase | Exposes methods to manage a SQLite database. |
SQLiteOpenHelper | A helper class to manage database creation and version management. |
SQLiteQuery | Represents a query that reads the resulting rows into a SQLiteQuery. |
SQLiteQueryBuilder | This is a convenience class that helps build SQL queries to be sent to SQLiteDatabase objects. |
SQLiteException | A SQLite exception that indicates there was an error with SQL parsing or execution. |
android.database.sqlite.SQLiteOpenHelper
SQLiteDatabase getReadableDatabase() | Create and/or open a database. |
SQLiteDatabase getWritableDatabase() | Create and/or open a database that will be used for reading and writing. |
abstract void onCreate(SQLiteDatabase db) | Called when the database is created for the first time. |
SQLiteDatabase
https://www.javatpoint.com/android-sqlite-tutorial
SQLiteDatabase
Long insert(String table, String nullColumnHack, ContentValues values) |
Convenience method for inserting a row into the database. |
Int update(String table, ContentValues values, String whereClause, String[] whereArgs) |
Convenience method for updating rows in the database. |
Int delete(String table, String whereClause, String[] whereArgs) |
Convenience method for deleting rows in the database. |
https://www.javatpoint.com/android-sqlite-tutorial
Extending "SQLiteOpenHelper" class
Upgrading DB & inserting data
Retrieving data
Cursor for retrieving data
Update
delete
rawQuery