android.database.DefaultDatabaseErrorHandler Java Examples

The following examples show how to use android.database.DefaultDatabaseErrorHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SQLiteDatabase.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private SQLiteDatabase(final String path, final int openFlags,
        CursorFactory cursorFactory, DatabaseErrorHandler errorHandler,
        int lookasideSlotSize, int lookasideSlotCount, long idleConnectionTimeoutMs,
        String journalMode, String syncMode) {
    mCursorFactory = cursorFactory;
    mErrorHandler = errorHandler != null ? errorHandler : new DefaultDatabaseErrorHandler();
    mConfigurationLocked = new SQLiteDatabaseConfiguration(path, openFlags);
    mConfigurationLocked.lookasideSlotSize = lookasideSlotSize;
    mConfigurationLocked.lookasideSlotCount = lookasideSlotCount;
    // Disable lookaside allocator on low-RAM devices
    if (ActivityManager.isLowRamDeviceStatic()) {
        mConfigurationLocked.lookasideSlotCount = 0;
        mConfigurationLocked.lookasideSlotSize = 0;
    }
    long effectiveTimeoutMs = Long.MAX_VALUE;
    // Never close idle connections for in-memory databases
    if (!mConfigurationLocked.isInMemoryDb()) {
        // First, check app-specific value. Otherwise use defaults
        // -1 in idleConnectionTimeoutMs indicates unset value
        if (idleConnectionTimeoutMs >= 0) {
            effectiveTimeoutMs = idleConnectionTimeoutMs;
        } else if (DEBUG_CLOSE_IDLE_CONNECTIONS) {
            effectiveTimeoutMs = SQLiteGlobal.getIdleConnectionTimeout();
        }
    }
    mConfigurationLocked.idleConnectionTimeoutMs = effectiveTimeoutMs;
    mConfigurationLocked.journalMode = journalMode;
    mConfigurationLocked.syncMode = syncMode;
    if (!SQLiteGlobal.isCompatibilityWalSupported() || (
            SQLiteCompatibilityWalFlags.areFlagsSet() && !SQLiteCompatibilityWalFlags
                    .isCompatibilityWalSupported())) {
        mConfigurationLocked.openFlags |= DISABLE_COMPATIBILITY_WAL;
    }
}
 
Example #2
Source File: PreferencesSQLiteOpenHelper.java    From PreferencesProvider with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static PreferencesSQLiteOpenHelper newInstancePostHoneycomb(Context context) {
    return new PreferencesSQLiteOpenHelper(context, new DefaultDatabaseErrorHandler());
}