本文整理匯總了Java中android.database.sqlite.SQLiteStatement.clearBindings方法的典型用法代碼示例。如果您正苦於以下問題:Java SQLiteStatement.clearBindings方法的具體用法?Java SQLiteStatement.clearBindings怎麽用?Java SQLiteStatement.clearBindings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.database.sqlite.SQLiteStatement
的用法示例。
在下文中一共展示了SQLiteStatement.clearBindings方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, Tag entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(2, tag);
}
Integer size = entity.getSize();
if (size != null) {
stmt.bindLong(3, size);
}
}
示例2: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, PhotoItem entity) {
stmt.clearBindings();
int c = 0;
Long id = entity.getId();
++c;
if (id != null) {
stmt.bindLong(c, id);
}
++c; stmt.bindString(c, handleNull(entity.get_id()));
++c; stmt.bindString(c, handleNull(entity.getName()));
++c; stmt.bindString(c, handleNull(entity.getPath()));
++c; stmt.bindString(c, handleNull(entity.getTag()));
++c; stmt.bindLong(c, entity.isStatus()?1:0);
}
示例3: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, MessageEntity entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindLong(2, entity.getMsgId());
stmt.bindLong(3, entity.getFromId());
stmt.bindLong(4, entity.getToId());
stmt.bindString(5, entity.getSessionKey());
stmt.bindString(6, entity.getContent());
stmt.bindLong(7, entity.getMsgType());
stmt.bindLong(8, entity.getDisplayType());
stmt.bindLong(9, entity.getStatus());
stmt.bindLong(10, entity.getCreated());
stmt.bindLong(11, entity.getUpdated());
}
示例4: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, BLinkedAccount entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String Token = entity.getToken();
if (Token != null) {
stmt.bindString(2, Token);
}
Integer type = entity.getType();
if (type != null) {
stmt.bindLong(3, type);
}
Long BUserDaoId = entity.getBUserDaoId();
if (BUserDaoId != null) {
stmt.bindLong(4, BUserDaoId);
}
}
示例5: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, ShoppingList entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getName());
stmt.bindLong(3, entity.getDate());
}
示例6: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, RelationSource2 entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
Long toOneId = entity.getToOneId();
if (toOneId != null) {
stmt.bindLong(2, toOneId);
}
}
示例7: updateDownloadCurrentBytes
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public void updateDownloadCurrentBytes(final DownloadInfo di) {
SQLiteStatement downloadCurrentBytes = getUpdateCurrentBytesStatement();
downloadCurrentBytes.clearBindings();
downloadCurrentBytes.bindLong(1, di.mCurrentBytes);
downloadCurrentBytes.bindLong(2, di.mIndex);
downloadCurrentBytes.execute();
}
示例8: performSetItem
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
SQLiteDatabase database = mDatabaseSupplier.getDatabase();
if (database == null) {
return false;
}
WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "set k-v to storage(key:" + key + ",value:" + value + ",isPersistent:" + isPersistent + ",allowRetry:" + allowRetryWhenFull + ")");
String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
SQLiteStatement statement = null;
String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
try {
statement = database.compileStatement(sql);
statement.clearBindings();
statement.bindString(1, key);
statement.bindString(2, value);
statement.bindString(3, timeStamp);
statement.bindLong(4, isPersistent ? 1 : 0);
statement.execute();
return true;
} catch (Exception e) {
WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
if (e instanceof SQLiteFullException) {
if (allowRetryWhenFull && trimToSize()) {
//try again
//setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "retry set k-v to storage(key:" + key + ",value:" + value + ")");
return performSetItem(key, value, isPersistent, false);
}
}
return false;
} finally {
if(statement != null) {
statement.close();
}
}
}
示例9: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, User entity) {
stmt.clearBindings();
String userName = entity.getUserName();
if (userName != null) {
stmt.bindString(1, userName);
}
String nick = entity.getNick();
if (nick != null) {
stmt.bindString(2, nick);
}
String avatar = entity.getAvatar();
if (avatar != null) {
stmt.bindString(3, avatar);
}
String objectId = entity.getObjectId();
if (objectId != null) {
stmt.bindString(4, objectId);
}
String college = entity.getCollege();
if (college != null) {
stmt.bindString(5, college);
}
Integer sex = entity.getSex();
if (sex != null) {
stmt.bindLong(6, sex);
}
String interest = entity.getInterest();
if (interest != null) {
stmt.bindString(7, interest);
}
}
示例10: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, AutoincrementEntity entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
}
示例11: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, AnActiveEntity entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String text = entity.getText();
if (text != null) {
stmt.bindString(2, text);
}
}
示例12: saveMonthly
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public void saveMonthly(List<MonthlyPvDatum> monthlyPvData) {
SQLiteDatabase db = pvDataHelper.getWritableDatabase();
db.beginTransaction();
String sql = "REPLACE INTO " + PvDataContract.MonthlyPvData.TABLE_NAME +
"(" + PvDataContract.MonthlyPvData.COLUMN_NAME_YEAR +
"," + PvDataContract.MonthlyPvData.COLUMN_NAME_MONTH +
"," + PvDataContract.MonthlyPvData.COLUMN_NAME_ENERGY_GENERATED +
") VALUES (?,?,?);";
SQLiteStatement statement = db.compileStatement(sql);
double maxEnergyGenerated = Double.MIN_VALUE;
for (MonthlyPvDatum monthlyPvDatum : monthlyPvData) {
statement.clearBindings();
statement.bindLong(1, monthlyPvDatum.getYear());
statement.bindLong(2, monthlyPvDatum.getMonth());
statement.bindDouble(3, monthlyPvDatum.getEnergyGenerated());
statement.execute();
maxEnergyGenerated = Math.max(maxEnergyGenerated, monthlyPvDatum.getEnergyGenerated());
}
db.setTransactionSuccessful();
db.endTransaction();
db.close();
Log.d(TAG, "Saved " + monthlyPvData.size() + " rows of monthly PV data to database");
RecordPvDatum recordPvDatum = loadRecord();
if (maxEnergyGenerated > recordPvDatum.getMonthlyEnergyGenerated()) {
recordPvDatum.setMonthlyEnergyGenerated(maxEnergyGenerated);
saveRecord(recordPvDatum);
}
}
示例13: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, Product entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getName());
stmt.bindDouble(3, entity.getCost());
}
示例14: insertUser
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private static void insertUser(@NonNull SQLiteStatement statement, @NonNull User user) {
statement.bindLong(1, user.getId());
bindString(statement, 2, user.getName());
bindString(statement, 3, user.getSecondName());
bindString(statement, 4, user.getEmail());
bindDate(statement, 5, user.getBirthday());
statement.executeInsert();
statement.clearBindings();
}
示例15: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, StringKeyValueEntity entity) {
stmt.clearBindings();
String key = entity.getKey();
if (key != null) {
stmt.bindString(1, key);
}
String value = entity.getValue();
if (value != null) {
stmt.bindString(2, value);
}
}