public class DatabaseManager
extends java.lang.Object
| Constructor and Description |
|---|
DatabaseManager(android.content.Context mContext) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Boolean |
createSchema(com.kasapakis.adam.plugin_model_library_core.database.schema.Schema schema)
method used to create a schema in the database.
|
void |
createTable(java.lang.String tableName,
java.lang.String[] columns,
java.lang.String[] types)
Method used to create a table in the database.
|
boolean |
delete(java.lang.String table,
java.lang.String whereClause,
java.lang.String[] whereArgs)
Method for deleting rows in the database.
|
java.lang.Boolean |
deleteTable(java.lang.String tableName)
Drops table from database.
|
java.lang.Long |
mInsert(java.lang.String table,
java.lang.String nullColumnHack,
android.content.ContentValues values)
Method for inserting a row into the database.
|
android.database.Cursor |
mQuery(java.lang.String table,
java.lang.String[] columns,
java.lang.String selection,
java.lang.String[] selectionArgs,
java.lang.String groupBy,
java.lang.String having,
java.lang.String orderBy)
Query the given table, returning a Cursor over the result set.
|
boolean |
replace(java.lang.String table,
java.lang.String nullColumnHack,
android.content.ContentValues initialValues)
Method for replacing a row in the database.
|
boolean |
upgradeTable(com.kasapakis.adam.plugin_model_library_core.database.schema.Table table,
com.kasapakis.adam.plugin_model_library_core.database.schema.updateDB.UpdateTableMap tableMap)
Upgrades a table according to the changes discribed in the table map.
|
public void createTable(java.lang.String tableName,
java.lang.String[] columns,
java.lang.String[] types)
tableName - String: name of table.columns - String[] column names.types - String[] types.public java.lang.Boolean createSchema(com.kasapakis.adam.plugin_model_library_core.database.schema.Schema schema)
schema - Schema: the object that contains information about the schema of teh database.public boolean upgradeTable(com.kasapakis.adam.plugin_model_library_core.database.schema.Table table,
com.kasapakis.adam.plugin_model_library_core.database.schema.updateDB.UpdateTableMap tableMap)
table - Table: table to upagrade.tableMap - UpdateTableMap: map the changes to the old table.public android.database.Cursor mQuery(java.lang.String table,
java.lang.String[] columns,
java.lang.String selection,
java.lang.String[] selectionArgs,
java.lang.String groupBy,
java.lang.String having,
java.lang.String orderBy)
table - String: The table name to compile the query against.columns - String: A list of which columns to return. Passing null will return all
columns, which is discouraged to prevent reading data from storage that
isn't going to be used.selection - String: A filter declaring which rows to return, formatted as an
SQL WHERE clause (excluding the WHERE itself). Passing null will return
all rows for the given table.selectionArgs - String: You may include ?s in selection, which will be replaced by the
values from selectionArgs, in order that they appear in the selection.
The values will be bound as Strings.groupBy - String: A filter declaring how to group rows, formatted as an
SQL GROUP BY clause (excluding the GROUP BY itself). Passing null will
cause the rows to not be grouped.having - String: A filter declare which row groups to include in the cursor,
if row grouping is being used, formatted as an SQL HAVING clause
(excluding the HAVING itself). Passing null will cause all row groups
to be included, and is required when row grouping is not being used.orderBy - String: How to order the rows, formatted as an SQL ORDER BY clause
(excluding the ORDER BY itself). Passing null will use the default sort
order, which may be unordered.public java.lang.Long mInsert(java.lang.String table,
java.lang.String nullColumnHack,
android.content.ContentValues values)
table - String: the table to insert the row into.nullColumnHack - String: optional; may be null. SQL doesn't allow inserting a completely
empty row without naming at least one column name. If your provided
values is empty, no column names are known and an empty row can't be
inserted. If not set to null, the nullColumnHack parameter provides
the name of nullable column name to explicitly insert a NULL into in
the case where your values is empty.values - ContentValues: this map contains the initial column values for the row.
The keys should be the column names and the values the column valuespublic java.lang.Boolean deleteTable(java.lang.String tableName)
tableName - name of table to drop.public boolean replace(java.lang.String table,
java.lang.String nullColumnHack,
android.content.ContentValues initialValues)
table - String: the table in which to replace the rownullColumnHack - String: optional; may be null. SQL doesn't allow inserting a completely
empty row without naming at least one column name. If your provided
initialValues is empty, no column names are known and an empty row
can't be inserted. If not set to null, the nullColumnHack parameter
provides the name of nullable column name to explicitly insert a NULL
into in the case where your initialValues is empty.initialValues - ContentValues: this map contains the initial column values for the row.
The keys should be the column names and the values the column values.public boolean delete(java.lang.String table,
java.lang.String whereClause,
java.lang.String[] whereArgs)
table - String: the table to delete from.whereClause - String: the optional WHERE clause to apply when deleting. Passing null
will delete all rows.whereArgs - String: You may include ?s in the where clause, which will be replaced by
the values from whereArgs. The values will be bound as Strings.