FileDocCategorySizeDatePackage
SqliteWrapper.javaAPI DocAndroid 5.1 API3732Thu Mar 12 22:22:10 GMT 2015android.database.sqlite

SqliteWrapper

public final class SqliteWrapper extends Object
hide

Fields Summary
private static final String
TAG
private static final String
SQLITE_EXCEPTION_DETAIL_MESSAGE
Constructors Summary
private SqliteWrapper()


      
        // Forbidden being instantiated.
    
Methods Summary
public static voidcheckSQLiteException(android.content.Context context, android.database.sqlite.SQLiteException e)

        if (isLowMemory(e)) {
            Toast.makeText(context, com.android.internal.R.string.low_memory,
                    Toast.LENGTH_SHORT).show();
        } else {
            throw e;
        }
    
public static intdelete(android.content.Context context, android.content.ContentResolver resolver, android.net.Uri uri, java.lang.String where, java.lang.String[] selectionArgs)

        try {
            return resolver.delete(uri, where, selectionArgs);
        } catch (SQLiteException e) {
            Log.e(TAG, "Catch a SQLiteException when delete: ", e);
            checkSQLiteException(context, e);
            return -1;
        }
    
public static android.net.Uriinsert(android.content.Context context, android.content.ContentResolver resolver, android.net.Uri uri, android.content.ContentValues values)

        try {
            return resolver.insert(uri, values);
        } catch (SQLiteException e) {
            Log.e(TAG, "Catch a SQLiteException when insert: ", e);
            checkSQLiteException(context, e);
            return null;
        }
    
private static booleanisLowMemory(android.database.sqlite.SQLiteException e)

        return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
    
public static android.database.Cursorquery(android.content.Context context, android.content.ContentResolver resolver, android.net.Uri uri, java.lang.String[] projection, java.lang.String selection, java.lang.String[] selectionArgs, java.lang.String sortOrder)

        try {
            return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
        } catch (SQLiteException e) {
            Log.e(TAG, "Catch a SQLiteException when query: ", e);
            checkSQLiteException(context, e);
            return null;
        }
    
public static booleanrequery(android.content.Context context, android.database.Cursor cursor)

        try {
            return cursor.requery();
        } catch (SQLiteException e) {
            Log.e(TAG, "Catch a SQLiteException when requery: ", e);
            checkSQLiteException(context, e);
            return false;
        }
    
public static intupdate(android.content.Context context, android.content.ContentResolver resolver, android.net.Uri uri, android.content.ContentValues values, java.lang.String where, java.lang.String[] selectionArgs)

        try {
            return resolver.update(uri, values, where, selectionArgs);
        } catch (SQLiteException e) {
            Log.e(TAG, "Catch a SQLiteException when update: ", e);
            checkSQLiteException(context, e);
            return -1;
        }