android.database.sqlite.SQLiteException#getMessage ( )源码实例Demo

下面列出了android.database.sqlite.SQLiteException#getMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: whassup   文件: Whassup.java
private Cursor getCursorFromDB(final File dbFile, long since, int max) throws IOException {
    Log.d(TAG, "using DB "+dbFile);
    SQLiteDatabase db = getSqLiteDatabase(dbFile);
    String limit = null;
    String selection = null;
    String[] selectionArgs = null;
    if (since > 0) {
        selection = String.format("%s > ?", TIMESTAMP);
        selectionArgs = new String[]{String.valueOf(since)};
    }
    if (max > 0) {
        limit = String.valueOf(max);
    }
    final String orderBy = TIMESTAMP + " ASC";

    try {
        return db.query(WhatsAppMessage.TABLE, null, selection, selectionArgs, null, null, orderBy, limit);
    } catch (SQLiteException e) {
        Log.w(TAG, "error querying DB", e);
        throw new IOException("Error querying DB: "+e.getMessage());
    }
}
 
源代码2 项目: ans-android-sdk   文件: AnsContentProvider.java
/**
 * 数据库表不存在异常
 */
private void tableException(SQLiteException sqLiteException) {
    if (sqLiteException != null && sqLiteException.getMessage() != null) {
        if (sqLiteException.getMessage().contains("no such table")) {
            dbReset();
        }
    }
}
 
源代码3 项目: pandora   文件: Databases.java
public DatabaseResult executeSQL(int databaseId, String sql) {
    Log.d(TAG, "executeSQL: " + sql);
    DatabaseResult result = new DatabaseResult();
    IDriver driver = holders.get(databaseId).driver;
    IDescriptor descriptor = holders.get(databaseId).descriptor;
    try {
        driver.executeSQL(descriptor, sql, result);
    } catch (SQLiteException e) {
        DatabaseResult.Error error = new DatabaseResult.Error();
        error.code = 0;
        error.message = e.getMessage();
        result.sqlError = error;
    }
    return result;
}
 
源代码4 项目: Overchan-Android   文件: FileCache.java
public long[] getSize() {
    try {
        return getSizeInternal();
    } catch (SQLiteException e) {
        if (e.getMessage() != null && e.getMessage().contains("no such table")) {
            Logger.e(TAG, "table in database not exists", e);
            resetDB();
            return getSizeInternal();
        } else {
            throw e;
        }
    }
}
 
源代码5 项目: whassup   文件: Whassup.java
private SQLiteDatabase getSqLiteDatabase(final File dbFile) throws IOException {
    try {
        return dbOpener.openDatabase(dbFile);
    } catch (SQLiteException e) {
        Log.w(TAG, "error opening db "+dbFile, e);
        throw new IOException("Error opening database:"+e.getMessage());
    }
}
 
源代码6 项目: RxZhihuDaily   文件: DatabaseHelper.java
public static final boolean isSQLiteDatabaseLockedException(SQLiteException e) {
    String message = e.getMessage();

    return !TextUtils.isEmpty(message) && message.contains("lock");
}
 
源代码7 项目: geopackage-android   文件: TestUtils.java
/**
 * Determine if the exception is caused from a missing function or module in
 * SQLite versions 4.2.0 and later. Lollipop uses version 3.8.4.3 so these
 * are not supported in Android.
 *
 * @param e
 * @return
 */
public static boolean isFutureSQLiteException(SQLiteException e) {
    String message = e.getMessage();
    return message.contains("no such function: ST_IsEmpty")
            || message.contains("no such module: rtree");
}