SQLiteDatabase setLockingEnabled - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SQLiteDatabase setLockingEnabled method.

This code example shows how to use the following methods:execSQL, setLockingEnabled
    public void onCreate(SQLiteDatabase db) {
        try { 
            /** 
             *     暂时将锁检查关闭,提升数据库创建速度 
             */ 
            db.setLockingEnabled(false);
        } finally { 
            db.execSQL(SQL_CREATE_DATABASE);
        } 
 
    } 
 
    @Override 
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (oldVersion < newVersion) {
            db.execSQL("DROP TABLE IF EXISTS " + MediaFile.Medias.TABLE_NAME);
            onCreate(db);
        } 
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:delete, setLockingEnabled
        // Always return the cached database, if we've got one 
        if (mDatabase == null || !mDatabase.isOpen()) {
            DatabaseHelper helper = new DatabaseHelper(context, DATABASE_NAME);
            mDatabase = helper.getWritableDatabase();
            if (mDatabase != null) {
                mDatabase.setLockingEnabled(true);
            } 
		} 
 
        return mDatabase;
    } 
 
    private class DatabaseHelper extends SQLiteOpenHelper {
 
        DatabaseHelper(Context context, String name) {
            super(context, name, null, DATABASE_VERSION);
        } 
 
        @Override 
        public void onCreate(SQLiteDatabase db) {

4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:rawQuery, setLockingEnabled
 
    @Override 
    public SQLiteDatabase getReadableDatabase() {
        SQLiteDatabase readableDatabase = super.getReadableDatabase();
        if (Build.VERSION.SDK_INT > 7 && Build.VERSION.SDK_INT < 16) {
            readableDatabase.setLockingEnabled(false);
        } 
        return readableDatabase;
    } 
 
	public synchronized void createTablesForModels(Class<?>... models) {
		SQLiteDatabase dbWriter = getWritableDatabase();
        if (Build.VERSION.SDK_INT > 10) {
            dbWriter.enableWriteAheadLogging();
        } 
        beginTransaction(dbWriter);
        StringBuilder builder = new StringBuilder();
        List<String> foreignKeys = new ArrayList<String>();
        for (Class<?> classOfModel : models) {
			String table = getTableName(classOfModel);

5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related SQLiteDatabase setLockingEnabled Questions & Answers:

setLockingEnabled Method Overview
This method was deprecated in API level 16. This method now does nothing. Do not use.
See Code Examples for other Android SQLiteDatabase Methods: