本文整理匯總了Java中android.database.sqlite.SQLiteStatement.bindString方法的典型用法代碼示例。如果您正苦於以下問題:Java SQLiteStatement.bindString方法的具體用法?Java SQLiteStatement.bindString怎麽用?Java SQLiteStatement.bindString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.database.sqlite.SQLiteStatement
的用法示例。
在下文中一共展示了SQLiteStatement.bindString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: insert
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public Uri insert(Uri uri, ContentValues values) {
SQLiteDatabase sqlDb = dbHelper.getWritableDatabase();
List<String> segments = uri.getPathSegments();
String recordId = segments.get(1);
String name = segments.get(3);
String insertView = "Insert or replace into views (record_id, name, query, date_synced) values(?,?,?,?)";
SQLiteStatement insertViewStmt = sqlDb.compileStatement(insertView);
insertViewStmt.bindString(1, recordId);
insertViewStmt.bindString(2, name);
insertViewStmt.bindString(3, values.getAsString("query"));
insertViewStmt.bindString(4, values.getAsString("date_synced"));
insertViewStmt.execute();
getContext()
.getContentResolver()
.notifyChange(uri, null);
return uri;
}
示例2: executeInsertWithArgsThrowsAndDoesNotTrigger
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Test public void executeInsertWithArgsThrowsAndDoesNotTrigger() {
SQLiteStatement statement = real.compileStatement("INSERT INTO " + TABLE_EMPLOYEE + " ("
+ NAME + ", " + USERNAME + ") VALUES (?, ?)");
statement.bindString(1, "Alice Aliison");
statement.bindString(2, "alice");
db.createQuery(TABLE_EMPLOYEE, SELECT_EMPLOYEES)
.skip(1) // Skip initial
.subscribe(o);
try {
db.executeInsert(TABLE_EMPLOYEE, statement);
fail();
} catch (SQLException ignored) {
}
o.assertNoMoreEvents();
}
示例3: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, SessionEntity entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getSessionKey());
stmt.bindLong(3, entity.getPeerId());
stmt.bindLong(4, entity.getPeerType());
stmt.bindLong(5, entity.getLatestMsgType());
stmt.bindLong(6, entity.getLatestMsgId());
stmt.bindString(7, entity.getLatestMsgData());
stmt.bindLong(8, entity.getTalkId());
stmt.bindLong(9, entity.getCreated());
stmt.bindLong(10, entity.getUpdated());
}
示例4: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, LocalUser entity) {
stmt.clearBindings();
stmt.bindString(1, entity.getLogin());
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
String avatarUrl = entity.getAvatarUrl();
if (avatarUrl != null) {
stmt.bindString(3, avatarUrl);
}
Integer followers = entity.getFollowers();
if (followers != null) {
stmt.bindLong(4, followers);
}
Integer following = entity.getFollowing();
if (following != null) {
stmt.bindLong(5, following);
}
}
示例5: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, City entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String cityName = entity.getCityName();
if (cityName != null) {
stmt.bindString(2, cityName);
}
stmt.bindLong(3, entity.getCityCode());
stmt.bindLong(4, entity.getProvinceId());
}
示例6: deleteWallpapers
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public void deleteWallpapers(@NonNull List<Wallpaper> wallpapers) {
if (!openDatabase()) {
LogUtil.e("Database error: deleteWallpapers() failed to open database");
return;
}
String query = "DELETE FROM " +TABLE_WALLPAPERS+ " WHERE " +KEY_URL+ " = ?";
SQLiteStatement statement = mDatabase.get().mSQLiteDatabase.compileStatement(query);
mDatabase.get().mSQLiteDatabase.beginTransaction();
for (Wallpaper wallpaper : wallpapers) {
statement.clearBindings();
statement.bindString(1, wallpaper.getUrl());
statement.execute();
}
mDatabase.get().mSQLiteDatabase.setTransactionSuccessful();
mDatabase.get().mSQLiteDatabase.endTransaction();
}
示例7: 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);
}
示例8: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, Scene entity) {
stmt.clearBindings();
stmt.bindLong(1, entity.getId());
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
String iconUrl = entity.getIconUrl();
if (iconUrl != null) {
stmt.bindString(3, iconUrl);
}
String type = entity.getType();
if (type != null) {
stmt.bindString(4, type);
}
stmt.bindLong(5, entity.getVisiablity() ? 1L: 0L);
}
示例9: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, Province entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String provinceName = entity.getProvinceName();
if (provinceName != null) {
stmt.bindString(2, provinceName);
}
stmt.bindLong(3, entity.getProvinceCode());
}
示例10: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, Banner entity) {
stmt.clearBindings();
stmt.bindLong(1, entity.getId());
String url = entity.getUrl();
if (url != null) {
stmt.bindString(2, url);
}
String type = entity.getType();
if (type != null) {
stmt.bindString(3, type);
}
}
示例11: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, User entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
stmt.bindLong(3, entity.getAge());
}
示例12: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, VideoInfo entity) {
stmt.clearBindings();
Long ID = entity.getID();
if (ID != null) {
stmt.bindLong(1, ID);
}
Long fileID = entity.getFileID();
if (fileID != null) {
stmt.bindLong(2, fileID);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(3, name);
}
String path = entity.getPath();
if (path != null) {
stmt.bindString(4, path);
}
String time = entity.getTime();
if (time != null) {
stmt.bindString(5, time);
}
String size = entity.getSize();
if (size != null) {
stmt.bindString(6, size);
}
}
示例13: InsertToSqlite
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public void InsertToSqlite(String imei, String latitude, String longitude, String out)
{
SQLiteStatement statement = localdb.compileStatement("INSERT INTO position VALUES(?,?,?,datetime(),?)");
statement.bindString(1, imei);
statement.bindString(2, latitude);
statement.bindString(3, longitude);
statement.bindString(4, out);
statement.executeInsert();
statement.close();
}
示例14: Picture_Insert
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public void Picture_Insert(String country, String city, String latitude, String longitude,
byte[] thumbnail, String mainImg) {
// open read and write database
SQLiteDatabase db = getWritableDatabase();
// execute insert query
SQLiteStatement p = db.compileStatement("INSERT INTO Picture values(?,?,?,?,?,?,?);");
p.bindNull(1);
p.bindString(2, country);
p.bindString(3, city);
p.bindString(4, latitude);
p.bindString(5, longitude);
p.bindBlob(6, thumbnail);
p.bindString(7, mainImg);
p.execute();
db.close();
Log.d("Database :", "INSERT Complete!");
}
示例15: bindValues
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
@Override
protected final void bindValues(SQLiteStatement stmt, SimpleEntityNotNull entity) {
stmt.clearBindings();
stmt.bindLong(1, entity.getId());
stmt.bindLong(2, entity.getSimpleBoolean() ? 1L: 0L);
stmt.bindLong(3, entity.getSimpleByte());
stmt.bindLong(4, entity.getSimpleShort());
stmt.bindLong(5, entity.getSimpleInt());
stmt.bindLong(6, entity.getSimpleLong());
stmt.bindDouble(7, entity.getSimpleFloat());
stmt.bindDouble(8, entity.getSimpleDouble());
stmt.bindString(9, entity.getSimpleString());
stmt.bindBlob(10, entity.getSimpleByteArray());
}