Android SQLiteException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SQLiteException class.

This code example shows how to use the following methods: getMessage
        return outInfo.lowMemory;
    } 
 
    // FIXME: need to optimize this method. 
    private static boolean isLowMemory(SQLiteException e) {
        return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
    } 
 
    public static void checkSQLiteException(Context context, SQLiteException e) {
        if (isLowMemory(e)) {
            Toast.makeText(context, com.android.internal.R.string.low_memory,
                    Toast.LENGTH_SHORT).show();
        } else { 
            throw e;
        } 
    } 
 
    public static Cursor query(Context context, ContentResolver resolver, Uri uri,
            String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        try { 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: e, getMessage
        // Forbidden being instantiated. 
    } 
 
    // FIXME: need to optimize this method. 
    private static boolean isLowMemory(SQLiteException e) {
        return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
    } 
 
    public static void checkSQLiteException(Context context, SQLiteException e) {
        if (isLowMemory(e)) {
            Toast.makeText(context, "Low Memory",
                    Toast.LENGTH_SHORT).show();
        } else { 
            throw e;
        } 
    } 
 
    public static Cursor query(Context context, ContentResolver resolver, Uri uri,
            String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        try { 

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMessage
        log("Creating database table for " + getTableName()); 
        String createStatement = DbUtils.getCreateTable(getTableName());
        try { 
            db.execSQL(createStatement);
        } catch (SQLiteException ex) {
            if (ex.getMessage().startsWith("table " + getTableName() + " already exists: ")) {
                log("Table already exists: " + getTableName()); 
            } else { 
                log("Error executing SQL: " + createStatement, ex);
                throw ex;
            } 
        } 
 
    } 
 
    @Override 
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        log("Database version changed from " + oldVersion + " to " + newVersion);
 
        db.execSQL("DROP TABLE IF EXISTS " + getTableName());
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: toString
	public QueryExecutionContainerImpl(SQLiteDatabase db){
		this.db = db;
	} 
	 
	private void throwError(SQLiteException e){
		throw new QueryExecutionException("SQLiteAndroid error:" + e.toString());
	} 
	 
 
	@Override 
	public void executeOnly(Query q) {		
		Log.trace("Executing: %s", q);
		 
		try { 
			db.execSQL(q.getExecutableSql());
		} catch (SQLiteException e) {
			throwError(e);
		} 
	} 
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        try { 
            mIsInitializing = true;
            String path = databaseDirectory(mContext) + File.separator + mName;
            db = SQLiteDatabase.openDatabase(path, mFactory, SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
            if (db.getVersion() != mNewVersion) {
                throw new SQLiteException("Can't upgrade read-only database from version " +
                        db.getVersion() + " to " + mNewVersion + ": " + path);
            } 
 
            onOpen(db);
            Log.w(TAG, "Opened " + mName + " in read-only mode");
            mDatabase = db;
            return mDatabase;
        } finally { 
            mIsInitializing = false;
            if (db != null && db != mDatabase) db.close();
        } 
    } 
 
    /** 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android SQLiteException Questions & Answers:

See Code Examples for Android SQLiteException Methods: