SQLiteDirectCursorDriverpublic class SQLiteDirectCursorDriver extends Object implements SQLiteCursorDriverA cursor driver that uses the given query directly. |
Fields Summary |
---|
private static String | TAG | private String | mEditTable | private SQLiteDatabase | mDatabase | private android.database.Cursor | mCursor | private String | mSql | private SQLiteQuery | mQuery |
Constructors Summary |
---|
public SQLiteDirectCursorDriver(SQLiteDatabase db, String sql, String editTable)
mDatabase = db;
mEditTable = editTable;
//TODO remove all callers that end in ; and remove this check
if (sql.charAt(sql.length() - 1) == ';") {
Log.w(TAG, "Found SQL string that ends in ; -- " + sql);
sql = sql.substring(0, sql.length() - 1);
}
mSql = sql;
|
Methods Summary |
---|
public void | cursorClosed()
mCursor = null;
| public void | cursorDeactivated()
// Do nothing
| public void | cursorRequeried(android.database.Cursor cursor)
// Do nothing
| public android.database.Cursor | query(android.database.sqlite.SQLiteDatabase.CursorFactory factory, java.lang.String[] selectionArgs)
// Compile the query
SQLiteQuery query = new SQLiteQuery(mDatabase, mSql, 0, selectionArgs);
try {
// Arg binding
int numArgs = selectionArgs == null ? 0 : selectionArgs.length;
for (int i = 0; i < numArgs; i++) {
query.bindString(i + 1, selectionArgs[i]);
}
// Create the cursor
if (factory == null) {
mCursor = new SQLiteCursor(mDatabase, this, mEditTable, query);
} else {
mCursor = factory.newCursor(mDatabase, this, mEditTable, query);
}
mQuery = query;
query = null;
return mCursor;
} finally {
// Make sure this object is cleaned up if something happens
if (query != null) query.close();
}
| public void | setBindArguments(java.lang.String[] bindArgs)
final int numArgs = bindArgs.length;
for (int i = 0; i < numArgs; i++) {
mQuery.bindString(i + 1, bindArgs[i]);
}
| public java.lang.String | toString()
return "SQLiteDirectCursorDriver: " + mSql;
|
|