FileDocCategorySizeDatePackage
SQLiteDirectCursorDriver.javaAPI DocAndroid 1.5 API3009Wed May 06 22:41:54 BST 2009android.database.sqlite

SQLiteDirectCursorDriver

public class SQLiteDirectCursorDriver extends Object implements SQLiteCursorDriver
A cursor driver that uses the given query directly.
hide

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 voidcursorClosed()

        mCursor = null;
    
public voidcursorDeactivated()

        // Do nothing
    
public voidcursorRequeried(android.database.Cursor cursor)

        // Do nothing
    
public android.database.Cursorquery(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 voidsetBindArguments(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.StringtoString()

        return "SQLiteDirectCursorDriver: " + mSql;