Codota Logo
SQLiteStatement.execute
Code IndexAdd Codota to your IDE (free)

How to use
execute
method
in
android.database.sqlite.SQLiteStatement

Best Java code snippets using android.database.sqlite.SQLiteStatement.execute (Showing top 20 results out of 405)

  • Common ways to obtain SQLiteStatement
private void myMethod () {
SQLiteStatement s =
  • Codota IconSQLiteDatabase db;String sql;db.compileStatement(sql)
  • Codota IconSQLiteDatabase sQLiteDatabase;sQLiteDatabase.compileStatement("UPDATE favorites SET itemType=" + Favorites.ITEM_TYPE_APPLICATION + " WHERE _id=?")
  • Smart code suggestions by Codota
}
origin: greenrobot/greenDAO

@Override
public void execute() {
  delegate.execute();
}
origin: stackoverflow.com

 public void insertUser(){
  SQLiteDatabase db               =   dbHelper.getWritableDatabase();

  String delSql                       =   "DELETE FROM ACCOUNTS";
  SQLiteStatement delStmt         =   db.compileStatement(delSql);
  delStmt.execute();

  String sql                      =   "INSERT INTO ACCOUNTS (account_id,account_name,account_image) VALUES(?,?,?)";
  SQLiteStatement insertStmt      =   db.compileStatement(sql);
  insertStmt.clearBindings();
  insertStmt.bindString(1, Integer.toString(this.accId));
  insertStmt.bindString(2,this.accName);
  insertStmt.bindBlob(3, this.accImage);
  insertStmt.executeInsert();
  db.close();
}
origin: stackoverflow.com

 String sql = "CREATE TABLE table_name (column_1 INTEGER PRIMARY KEY, column_2 TEXT)";
SQLiteStatement stmt = db.compileStatement(sql);
stmt.execute();
origin: greenrobot/greenDAO

  updateKeyAfterInsertAndAttach(entity, rowId, false);
} else {
  rawStmt.execute();
origin: stackoverflow.com

 SQLiteDatabase db = dbHelper.getWritableDatabase();
SQLiteStatement stmt = db.compileStatement("SELECT * FROM Country WHERE code = ?");
stmt.bindString(1, "US");
stmt.execute();
origin: stackoverflow.com

final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
 final SQLiteStatement statement = db.compileStatement(INSERT_QUERY);
 db.beginTransaction();
 try {
   for(MyBean bean : list){
     statement.clearBindings();
     statement.bindString(1, bean.getName());
     // rest of bindings
     statement.execute(); //or executeInsert() if id is needed
   }
   db.setTransactionSuccessful();
 } finally {
   db.endTransaction();
 }
origin: k9mail/k-9

void put(String key, String value) {
  insertStatement.bindString(1, key);
  insertStatement.bindString(2, value);
  insertStatement.execute();
  insertStatement.clearBindings();
  workingStorage.put(key, value);
}
origin: yigit/android-priority-jobqueue

private void delete(String id) {
  db.beginTransaction();
  try {
    SQLiteStatement stmt = sqlHelper.getDeleteStatement();
    stmt.clearBindings();
    stmt.bindString(1, id);
    stmt.execute();
    SQLiteStatement deleteTagsStmt = sqlHelper.getDeleteJobTagsStatement();
    deleteTagsStmt.bindString(1, id);
    deleteTagsStmt.execute();
    db.setTransactionSuccessful();
    jobStorage.delete(id);
  } finally {
    db.endTransaction();
  }
}
origin: kaaproject/kaa

@Override
public void removeBucket(int recordBlockId) {
 synchronized (database) {
  Log.d(TAG, "Removing record block with id [" + recordBlockId + "] from storage");
  if (deleteByBucketIdStatement == null) {
   try {
    deleteByBucketIdStatement = database.compileStatement(
        PersistentLogStorageConstants.KAA_DELETE_BY_BUCKET_ID);
   } catch (SQLiteException ex) {
    Log.e(TAG, "Can't create record block deletion statement", ex);
    throw new RuntimeException(ex);
   }
  }
  try {
   deleteByBucketIdStatement.bindLong(1, recordBlockId);
   deleteByBucketIdStatement.execute();
   long removedRecordsCount = getAffectedRowCount();
   if (removedRecordsCount > 0) {
    totalRecordCount -= removedRecordsCount;
    Log.i(TAG, "Removed " + removedRecordsCount
      + " records from storage. Total log record count: " + totalRecordCount);
   } else {
    Log.i(TAG, "No records were removed from storage");
   }
  } catch (SQLiteException ex) {
   Log.e(TAG, "Failed to remove record block with id [" + recordBlockId + "]", ex);
  }
 }
}
origin: kaaproject/kaa

resetBucketIdStatement.execute();
origin: greenrobot/greenDAO

protected void updateInsideSynchronized(T entity, SQLiteStatement stmt, boolean lock) {
  // To do? Check if it's worth not to bind PKs here (performance).
  bindValues(stmt, entity);
  int index = config.allColumns.length + 1;
  K key = getKey(entity);
  if (key instanceof Long) {
    stmt.bindLong(index, (Long) key);
  } else if (key == null) {
    throw new DaoException("Cannot update entity without key - was it inserted before?");
  } else {
    stmt.bindString(index, key.toString());
  }
  stmt.execute();
  attachEntity(key, entity, lock);
}
origin: kaaproject/kaa

private void updateStorageParams() {
 SQLiteStatement updateInfoStatement = null;
 try {
  updateInfoStatement = database.compileStatement(
      PersistentLogStorageConstants.KAA_UPDATE_STORAGE_INFO);
  updateInfoStatement.bindString(1, PersistentLogStorageConstants.STORAGE_BUCKET_SIZE);
  updateInfoStatement.bindLong(2, maxBucketSize);
  updateInfoStatement.execute();
  updateInfoStatement.bindString(1, PersistentLogStorageConstants.STORAGE_RECORD_COUNT);
  updateInfoStatement.bindLong(2, maxRecordCount);
  updateInfoStatement.execute();
 } catch (SQLiteException ex) {
  Log.e(TAG, "Can't prepare update storage info statement", ex);
  throw new RuntimeException("Can't prepare update storage info statement");
 } finally {
  tryCloseStatement(updateInfoStatement);
 }
}
origin: kaaproject/kaa

private void updateBucketState(int bucketId) {
 synchronized (database) {
  Log.v(TAG, "Updating bucket id [" + bucketId + "]");
  try {
   if (updateBucketStateStatement == null) {
    updateBucketStateStatement = database.compileStatement(
        PersistentLogStorageConstants.KAA_UPDATE_BUCKET_ID);
   }
   updateBucketStateStatement.bindString(
       1, PersistentLogStorageConstants.BUCKET_STATE_COLUMN);
   updateBucketStateStatement.bindLong(2, bucketId);
   updateBucketStateStatement.execute();
   long affectedRows = getAffectedRowCount();
   if (affectedRows > 0) {
    Log.i(TAG, "Successfully updated state for bucket ID [" + bucketId
          + "] for log records: " + affectedRows);
   } else {
    Log.w(TAG, "No log records were updated");
   }
  } catch (SQLiteException ex) {
   Log.e(TAG, "Failed to update state for bucket [" + bucketId + "]", ex);
  }
 }
}
origin: yigit/android-priority-jobqueue

@Override
public void onJobCancelled(JobHolder jobHolder) {
  SQLiteStatement stmt = sqlHelper.getMarkAsCancelledStatement();
  stmt.clearBindings();
  stmt.bindString(1, jobHolder.getId());
  stmt.execute();
}
origin: robolectric/robolectric

@Before
public void setUp() throws Exception {
 final File databasePath = ApplicationProvider.getApplicationContext().getDatabasePath("path");
 databasePath.getParentFile().mkdirs();
 database = SQLiteDatabase.openOrCreateDatabase(databasePath.getPath(), null);
 SQLiteStatement createStatement = database.compileStatement("CREATE TABLE `routine` (`id` INTEGER PRIMARY KEY AUTOINCREMENT , `name` VARCHAR , `lastUsed` INTEGER DEFAULT 0 ,  UNIQUE (`name`)) ;");
 createStatement.execute();
 SQLiteStatement createStatement2 = database.compileStatement("CREATE TABLE `countme` (`id` INTEGER PRIMARY KEY AUTOINCREMENT , `name` VARCHAR , `lastUsed` INTEGER DEFAULT 0 ,  UNIQUE (`name`)) ;");
 createStatement2.execute();
}
origin: robolectric/robolectric

@Before
public void setUp() throws Exception {
 database = createDatabase("database.db");
 SQLiteStatement createStatement = database.compileStatement(
   "CREATE TABLE `routine` (`id` INTEGER PRIMARY KEY AUTOINCREMENT , `name` VARCHAR , `lastUsed` INTEGER DEFAULT 0 ,  UNIQUE (`name`)) ;");
 createStatement.execute();
 conn = getSQLiteConnection(database);
}
origin: yahoo/squidb

@Override
public void execute() {
  statement.execute();
}
origin: yigit/android-priority-jobqueue

/**
 * This method is called when a job is pulled to run.
 * It is properly marked so that it won't be returned from next job queries.
 * <p/>
 * Same mechanism is also used for cancelled jobs.
 *
 * @param jobHolder The job holder to update session id
 */
private void setSessionIdOnJob(JobHolder jobHolder) {
  SQLiteStatement stmt = sqlHelper.getOnJobFetchedForRunningStatement();
  jobHolder.setRunCount(jobHolder.getRunCount() + 1);
  jobHolder.setRunningSessionId(sessionId);
  stmt.clearBindings();
  stmt.bindLong(1, jobHolder.getRunCount());
  stmt.bindLong(2, sessionId);
  stmt.bindString(3, jobHolder.getId());
  stmt.execute();
}
origin: stackoverflow.com

 SQLiteStatement p = sqlite.compileStatement("insert into memes(img, name) values(?, ?)");

byte[] data = loadData("1.jpg");
p.bindBlob(1, data);
p.bindString(2, "1.jpg");
p.execute();

byte[] data = loadData("2.jpg");
p.bindBlob(1, data);
p.bindString(2, "2.jpg");
p.execute();
origin: weexteam/weex-hackernews

  statement.bindString(3, timeStamp);
  statement.bindLong(4, isPersistent ? 1 : 0);
  statement.execute();
  return true;
} catch (Exception e) {
android.database.sqliteSQLiteStatementexecute

Popular methods of SQLiteStatement

  • bindLong
  • bindString
  • clearBindings
  • executeInsert
  • close
  • bindDouble
  • bindBlob
  • executeUpdateDelete
  • simpleQueryForLong
  • bindNull
  • simpleQueryForString
  • bindAllArgsAsStrings
  • simpleQueryForString,
  • bindAllArgsAsStrings,
  • bindDate,
  • bindInt,
  • bindInteger,
  • bindValue,
  • simpleQueryForBlobFileDescriptor,
  • toString

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JTextField (javax.swing)
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