Codota Logo
SQLiteDatabase.isDbLockedByCurrentThread
Code IndexAdd Codota to your IDE (free)

How to use
isDbLockedByCurrentThread
method
in
android.database.sqlite.SQLiteDatabase

Best Java code snippets using android.database.sqlite.SQLiteDatabase.isDbLockedByCurrentThread (Showing top 20 results out of 315)

  • Common ways to obtain SQLiteDatabase
private void myMethod () {
SQLiteDatabase s =
  • Codota IconSQLiteOpenHelper dbHelper;dbHelper.getWritableDatabase()
  • Codota IconWeatherDbHelper dbHelper;dbHelper.getWritableDatabase()
  • Codota IconSQLiteOpenHelper dbHelper;dbHelper.getReadableDatabase()
  • Smart code suggestions by Codota
}
origin: greenrobot/greenDAO

@Override
public boolean isDbLockedByCurrentThread() {
  return delegate.isDbLockedByCurrentThread();
}
origin: square/assertj-android

public SqliteDatabaseAssert isNotLockedByCurrentThread() {
 isNotNull();
 assertThat(actual.isDbLockedByCurrentThread()) //
   .overridingErrorMessage("Expected DB to not be locked but current thread but was.") //
   .isFalse();
 return this;
}
origin: square/assertj-android

public SqliteDatabaseAssert isLockedByCurrentThread() {
 isNotNull();
 assertThat(actual.isDbLockedByCurrentThread()) //
   .overridingErrorMessage("Expected DB to be locked by current thread but was not.") //
   .isTrue();
 return this;
}
origin: yahoo/squidb

@Override
public boolean isDbLockedByCurrentThread() {
  return db.isDbLockedByCurrentThread();
}
origin: org.greenrobot/greendao-encryption

@Override
public boolean isDbLockedByCurrentThread() {
  return delegate.isDbLockedByCurrentThread();
}
origin: org.greenrobot/greendao

@Override
public boolean isDbLockedByCurrentThread() {
  return delegate.isDbLockedByCurrentThread();
}
origin: daolq3012/AssetSQLiteOpenHelper

@Override
public boolean isDbLockedByCurrentThread() {
  return mDelegate.isDbLockedByCurrentThread();
}
origin: jeffdcamp/dbtools-android

public boolean isDbLockedByCurrentThread() {
  return database.isDbLockedByCurrentThread();
}
origin: inthepocket/ibeacon-scanner-android

/**
 * Close the connection to the database to avoid database leaks.
 */
public void destroy()
{
  if (this.database != null && this.database.isDbLockedByCurrentThread())
  {
    this.database.close();
  }
}
origin: xcesco/kripton

/**
 * <p>
 * return true if database is already opened.
 * </p>
 * 
 * @return true if database is opened, otherwise false
 */
public boolean isOpen() {
  return database != null && database.isOpen() && database.isDbLockedByCurrentThread();
}
origin: com.abubusoft/kripton-orm

/**
 * <p>
 * return true if database is already opened.
 * </p>
 * 
 * @return true if database is opened, otherwise false
 */
public boolean isOpen() {
  return database != null && database.isOpen() && database.isDbLockedByCurrentThread();
}
origin: com.abubusoft/kripton-orm

/**
 * <p>
 * return true if database is already opened in write mode.
 * </p>
 * 
 * @return true if database is opened, otherwise false
 */
public boolean isOpenInWriteMode() {
  // return database != null && database.isOpen() &&
  // !database.isReadOnly() && database.isDbLockedByCurrentThread();
  return database != null && !database.isReadOnly() && database.isDbLockedByCurrentThread();
}
origin: xcesco/kripton

/**
 * <p>
 * return true if database is already opened in write mode.
 * </p>
 * 
 * @return true if database is opened, otherwise false
 */
public boolean isOpenInWriteMode() {
  // return database != null && database.isOpen() &&
  // !database.isReadOnly() && database.isDbLockedByCurrentThread();
  return database != null && !database.isReadOnly() && database.isDbLockedByCurrentThread();
}
origin: com.squareup.assertj/assertj-android

public SqliteDatabaseAssert isNotLockedByCurrentThread() {
 isNotNull();
 assertThat(actual.isDbLockedByCurrentThread()) //
   .overridingErrorMessage("Expected DB to not be locked but current thread but was.") //
   .isFalse();
 return this;
}
origin: com.squareup.assertj/assertj-android

public SqliteDatabaseAssert isLockedByCurrentThread() {
 isNotNull();
 assertThat(actual.isDbLockedByCurrentThread()) //
   .overridingErrorMessage("Expected DB to be locked by current thread but was not.") //
   .isTrue();
 return this;
}
origin: de.greenrobot/greendao

/**
 * Deletes all matching entities without detaching them from the identity scope (aka session/cache). Note that this
 * method may lead to stale entity objects in the session cache. Stale entities may be returned when loaded by their
 * primary key, but not using queries.
 */
public void executeDeleteWithoutDetachingEntities() {
  checkThread();
  SQLiteDatabase db = dao.getDatabase();
  if (db.isDbLockedByCurrentThread()) {
    dao.getDatabase().execSQL(sql, parameters);
  } else {
    // Do TX to acquire a connection before locking this to avoid deadlocks
    // Locking order as described in AbstractDao
    db.beginTransaction();
    try {
      dao.getDatabase().execSQL(sql, parameters);
      db.setTransactionSuccessful();
    } finally {
      db.endTransaction();
    }
  }
}
origin: de.greenrobot/greendao

public void update(T entity) {
  assertSinglePk();
  SQLiteStatement stmt = statements.getUpdateStatement();
  if (db.isDbLockedByCurrentThread()) {
    synchronized (stmt) {
      updateInsideSynchronized(entity, stmt, true);
    }
  } else {
    // Do TX to acquire a connection before locking the stmt to avoid deadlocks
    db.beginTransaction();
    try {
      synchronized (stmt) {
        updateInsideSynchronized(entity, stmt, true);
      }
      db.setTransactionSuccessful();
    } finally {
      db.endTransaction();
    }
  }
}
origin: de.greenrobot/greendao

private long executeInsert(T entity, SQLiteStatement stmt) {
  long rowId;
  if (db.isDbLockedByCurrentThread()) {
    synchronized (stmt) {
      bindValues(stmt, entity);
      rowId = stmt.executeInsert();
    }
  } else {
    // Do TX to acquire a connection before locking the stmt to avoid deadlocks
    db.beginTransaction();
    try {
      synchronized (stmt) {
        bindValues(stmt, entity);
        rowId = stmt.executeInsert();
      }
      db.setTransactionSuccessful();
    } finally {
      db.endTransaction();
    }
  }
  updateKeyAfterInsertAndAttach(entity, rowId, true);
  return rowId;
}
origin: de.greenrobot/greendao

/** Deletes an entity with the given PK from the database. Currently, only single value PK entities are supported. */
public void deleteByKey(K key) {
  assertSinglePk();
  SQLiteStatement stmt = statements.getDeleteStatement();
  if (db.isDbLockedByCurrentThread()) {
    synchronized (stmt) {
      deleteByKeyInsideSynchronized(key, stmt);
    }
  } else {
    // Do TX to acquire a connection before locking the stmt to avoid deadlocks
    db.beginTransaction();
    try {
      synchronized (stmt) {
        deleteByKeyInsideSynchronized(key, stmt);
      }
      db.setTransactionSuccessful();
    } finally {
      db.endTransaction();
    }
  }
  if (identityScope != null) {
    identityScope.remove(key);
  }
}
origin: de.greenrobot/greendao

/**
 * Insert an entity into the table associated with a concrete DAO <b>without</b> setting key property. Warning: This
 * may be faster, but the entity should not be used anymore. The entity also won't be attached to identy scope.
 *
 * @return row ID of newly inserted entity
 */
public long insertWithoutSettingPk(T entity) {
  SQLiteStatement stmt = statements.getInsertStatement();
  long rowId;
  if (db.isDbLockedByCurrentThread()) {
    synchronized (stmt) {
      bindValues(stmt, entity);
      rowId = stmt.executeInsert();
    }
  } else {
    // Do TX to acquire a connection before locking the stmt to avoid deadlocks
    db.beginTransaction();
    try {
      synchronized (stmt) {
        bindValues(stmt, entity);
        rowId = stmt.executeInsert();
      }
      db.setTransactionSuccessful();
    } finally {
      db.endTransaction();
    }
  }
  return rowId;
}
android.database.sqliteSQLiteDatabaseisDbLockedByCurrentThread

Popular methods of SQLiteDatabase

  • execSQL
  • insert
  • delete
  • query
  • rawQuery
  • close
  • update
  • endTransaction
  • setTransactionSuccessful
  • beginTransaction
  • isOpen
  • compileStatement
  • isOpen,
  • compileStatement,
  • getVersion,
  • insertWithOnConflict,
  • openDatabase,
  • insertOrThrow,
  • replace,
  • getPath,
  • openOrCreateDatabase,
  • setVersion

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getContentResolver (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now