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

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
This code example shows how to use the following methods: close, isOpen, isReadOnly
     * 
     * @throws SQLiteException if the database cannot be opened for writing 
     * @return a read/write database object valid until {@link #close} is called 
     */ 
    public synchronized SQLiteDatabase getWritableDatabase() {
        if (mDatabase != null && mDatabase.isOpen() && !mDatabase.isReadOnly()) {
            return mDatabase;  // The database is already open for business
        } 
 
        if (mIsInitializing) {
            throw new IllegalStateException("getWritableDatabase called recursively");
        } 
 
        // If we have a read-only database open, someone could be using it 
        // (though they shouldn't), which would cause a lock to be held on 
        // the file, and our attempts to open the database read-write would 
        // fail waiting for the file lock.  To prevent that, we acquire the 
        // lock on the read-only database, which shuts out other users. 
 
        boolean success = false;

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, isOpen, isReadOnly
     * 
     * @throws SQLiteException if the database cannot be opened for writing 
     * @return a read/write database object valid until {@link #close} is called 
     */ 
    public synchronized SQLiteDatabase getWritableDatabase() {
        if (mDatabase != null && mDatabase.isOpen() && !mDatabase.isReadOnly()) {
            return mDatabase;  // The database is already open for business
        } 
 
        if (mIsInitializing) {
            throw new IllegalStateException("getWritableDatabase called recursively");
        } 
 
        // If we have a read-only database open, someone could be using it 
        // (though they shouldn't), which would cause a lock to be held on 
        // the file, and our attempts to open the database read-write would 
        // fail waiting for the file lock.  To prevent that, we acquire the 
        // lock on the read-only database, which shuts out other users. 
 
        boolean success = false;

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: isOpen, isReadOnly, getClass

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: delete, isOpen
    private SQLiteDatabase mDatabase;
 
    @SuppressWarnings("deprecation") 
    public synchronized SQLiteDatabase getDatabase(Context context) {
        // 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);

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

Related SQLiteDatabase isOpen Questions & Answers:

Other SQLiteDatabase isOpen Examples

363:		public void closeDB() {
364:			SQLiteDatabase db = this.getReadableDatabase();
365:			if (db != null && db.isOpen())
366:				db.close();
367:		}

Read More

1:		public void closeDB() {
2:			SQLiteDatabase db = this.getReadableDatabase();
3:			if (db != null && db.isOpen())
4:				db.close();
5:		}

Read More

isOpen Method Overview
Returns true if the database is currently open.
See Code Examples for other Android SQLiteDatabase Methods: