Java Code Examples for android.database.sqlite.SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING

The following examples show how to use android.database.sqlite.SQLiteDatabase#ENABLE_WRITE_AHEAD_LOGGING . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 2
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 3
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 4
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 5
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 6
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 7
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 8
Source Project: android_9.0.0_r45   File: ContextImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    checkMode(mode);
    File f = getDatabasePath(name);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    if ((mode & MODE_NO_LOCALIZED_COLLATORS) != 0) {
        flags |= SQLiteDatabase.NO_LOCALIZED_COLLATORS;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 9
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    File f = validateFilePath(name, true);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 10
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    File f = validateFilePath(name, true);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 11
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    File f = validateFilePath(name, true);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 12
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    File f = validateFilePath(name, true);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 13
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    File f = validateFilePath(name, true);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 14
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    File f = validateFilePath(name, true);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 15
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
        DatabaseErrorHandler errorHandler) {
    File f = validateFilePath(name, true);
    int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
    if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
        flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
    setFilePermissionsFromMode(f.getPath(), mode, 0);
    return db;
}
 
Example 16
Source Project: pandora   File: DatabaseProvider.java    License: Apache License 2.0 5 votes vote down vote up
private int checkIfCanOpenWithWAL(File databaseFile) {
    int flags = 0;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        File walFile = new File(databaseFile.getParent(), databaseFile.getName() + "-wal");
        if (walFile.exists()) {
            flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
        }
    }
    return flags;
}
 
Example 17
Source Project: pandora   File: DatabaseProvider.java    License: Apache License 2.0 5 votes vote down vote up
private SQLiteDatabase performOpen(File databaseFile, int options) {
    int flags = SQLiteDatabase.OPEN_READWRITE;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        if ((options & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0) {
            flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
        }
    }
    SQLiteDatabase db = SQLiteDatabase.openDatabase(databaseFile.getAbsolutePath(), null, flags);
    return db;
}
 
Example 18
Source Project: stetho   File: SQLiteDatabaseCompat.java    License: MIT License 5 votes vote down vote up
@Override
public int provideOpenFlags(@SQLiteOpenOptions int openOptions) {
  int openFlags = 0;
  if ((openOptions & ENABLE_WRITE_AHEAD_LOGGING) != 0) {
    openFlags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
  }
  return openFlags;
}