本文整理汇总了Java中net.sqlcipher.database.SQLiteStatement.bindString方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteStatement.bindString方法的具体用法?Java SQLiteStatement.bindString怎么用?Java SQLiteStatement.bindString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sqlcipher.database.SQLiteStatement
的用法示例。
在下文中一共展示了SQLiteStatement.bindString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindValues
import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
@Override protected final void bindValues(SQLiteStatement stmt, User entity) {
stmt.clearBindings();
stmt.bindLong(1, entity.getId());
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
stmt.bindLong(3, entity.getAge());
}
示例2: bulkKeyStore
import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void bulkKeyStore(int c, String dbid, String values[]) {
if(database !=null && database.isOpen()) {
SQLiteStatement statement =
database.compileStatement("INSERT INTO " +
TABLE_KEYS + " VALUES (null, ?, ?, ?, ?);");
database.beginTransaction();
while (c < (values.length - 1)) {
statement.clearBindings();
statement.bindString(1, values[c]);
statement.bindString(2, dbid);
statement.bindString(3, values[c + 1]);
statement.bindString(4, values[c + 2]);
statement.execute();
c = c + 3;
}
database.setTransactionSuccessful();
database.endTransaction();
//disable adding contact if over
Cursor contactCount = database.rawQuery("SELECT * FROM " + TABLE_CONTACTS, null);
int max_contacts = context.getResources().getInteger(R.integer.config_max_contacts);
if (contactCount.getCount() >= max_contacts) {
prefs.edit().putBoolean(CONST.PREFS_CONTACTADD, false).apply();
}
contactCount.close();
}
}
示例3: bindString
import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void bindString(SQLiteStatement stmt, int index, String value) {
if (value == null) {
stmt.bindNull(index);
}
else {
stmt.bindString(index, value);
}
}
示例4: insertNormalizedNameLookup
import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void insertNormalizedNameLookup(SQLiteStatement stmt, long rawContactId, long dataId, int lookupType,
String normalizedName) {
stmt.bindLong(1, rawContactId);
stmt.bindLong(2, dataId);
stmt.bindLong(3, lookupType);
stmt.bindString(4, normalizedName);
stmt.executeInsert();
}
示例5: deleteByKeyInsideSynchronized
import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void deleteByKeyInsideSynchronized(K key, SQLiteStatement stmt) {
if (key instanceof Long) {
stmt.bindLong(1, (Long) key);
} else if (key == null) {
throw new DaoException("Cannot delete entity, key is null");
} else {
stmt.bindString(1, key.toString());
}
stmt.execute();
}
示例6: updateInsideSynchronized
import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
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);
}
示例7: bindArgs
import net.sqlcipher.database.SQLiteStatement; //导入方法依赖的package包/类
private void bindArgs(SQLiteStatement stmt, Object[] args, FieldType[] argFieldTypes) throws SQLException {
if (args == null) {
return;
}
for (int i = 0; i < args.length; i++) {
Object arg = args[i];
if (arg == null) {
stmt.bindNull(i + 1);
} else {
SqlType sqlType = argFieldTypes[i].getSqlType();
switch (sqlType) {
case STRING :
case LONG_STRING :
case CHAR :
stmt.bindString(i + 1, arg.toString());
break;
case BOOLEAN :
case BYTE :
case SHORT :
case INTEGER :
case LONG :
stmt.bindLong(i + 1, ((Number) arg).longValue());
break;
case FLOAT :
case DOUBLE :
stmt.bindDouble(i + 1, ((Number) arg).doubleValue());
break;
case BYTE_ARRAY :
case SERIALIZABLE :
stmt.bindBlob(i + 1, (byte[]) arg);
break;
case DATE :
// this is mapped to a STRING under Android
case BLOB :
// this is only for derby serializable
case BIG_DECIMAL :
// this should be handled as a STRING
throw new SQLException("Invalid Android type: " + sqlType);
case UNKNOWN :
default :
throw new SQLException("Unknown sql argument type: " + sqlType);
}
}
}
}