Tabnine Logo
SQLiteStatement.execute
Code IndexAdd Tabnine 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)

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

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • onRequestPermissionsResult (Fragment)
  • findViewById (Activity)
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now