SQLiteDatabase endTransaction - 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 endTransaction method.

This code example shows how to use the following methods: beginTransaction, endTransaction, setTransactionSuccessful
 
        final SQLiteDatabase db = getWritable(helper);
        if (db == null)
            return items;
 
        db.beginTransaction();
        try { 
            persistableResource.store(db, items);
            db.setTransactionSuccessful();
        } finally { 
            db.endTransaction();
        } 
        return items;
    } 
 
    private <E> List<E> loadFromDB(final SQLiteOpenHelper helper,
            final PersistableResource<E> persistableResource) {
        final SQLiteDatabase db = getReadable(helper);
        if (db == null)
            return null; 
Full Snippet Info
9
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: beginTransaction, endTransaction, setTransactionSuccessful, update
    @Override 
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
        SQLiteDatabase db = null;
        try { 
            db = mDatabaseHelper.getWritableDatabase();
            db.beginTransaction();
 
            String newSelection = buildSelection(uri, selection);
            int count = db.update("tests", values, newSelection, selectionArgs);
            db.setTransactionSuccessful();
            return count;
        } finally { 
            if (db != null) {
                db.endTransaction();
            } 
        } 
    } 
 
    private String buildSelection(Uri uri, String selection) {
        long id = 0;
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: beginTransaction, delete, endTransaction, setTransactionSuccessful
            file = new File(getLockPatternFilename(userId));
            if (file.exists()) {
                file.delete();
            } 
 
            db.beginTransaction();
            db.delete(TABLE, COLUMN_USERID + "='" + userId + "'", null);
            db.setTransactionSuccessful();
        } finally { 
            db.endTransaction();
        } 
    } 
 
    private void writeFile(String name, byte[] hash) {
        try { 
            // Write the hash to file 
            RandomAccessFile raf = new RandomAccessFile(name, "rw");
            // Truncate the file if pattern is null, to clear the lock 
            if (hash == null || hash.length == 0) {
                raf.setLength(0);
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: close, beginTransaction, endTransaction, getVersion, setTransactionSuccessful
                    db = SQLiteDatabase.openOrCreateDatabase(new File(mPath, mName), mFactory);
                else 
                    db = mContext.openOrCreateDatabase(mName, 0, mFactory);
            } 
 
            int version = db.getVersion();
            if (version != mNewVersion) {
                db.beginTransaction();
                try { 
                    if (version == 0) {
                        onCreate(db);
                    } else { 
                        onUpgrade(db, version, mNewVersion);
                    } 
                    db.setVersion(mNewVersion);
                    db.setTransactionSuccessful();
                } finally { 
                    db.endTransaction();
                } 
            } 

8
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: close, beginTransaction, compileStatement, endTransaction, isOpen
	} 
 
	public DataManager(Context context, boolean useDebugDb) {
		this.context = context;
		this.useDebugDb = useDebugDb;
	} 
 
	private boolean isOpenDb() { 
		return (db != null && db.isOpen());
	} 
 
	private boolean closeDb() { 
		if (isOpenDb()) { 
			try { 
				db.close();
				 
				db = null;
				rpgCharacterDao = null;
				 
				return true; 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related SQLiteDatabase endTransaction Questions & Answers:

endTransaction Method Overview
End a transaction.
See Code Examples for other Android SQLiteDatabase Methods: