當前位置: 首頁>>代碼示例>>Java>>正文


Java SQLiteStatement.bindString方法代碼示例

本文整理匯總了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;
}
 
開發者ID:Microsoft,項目名稱:healthvault-java-sdk,代碼行數:24,代碼來源:ViewProvider.java

示例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();
}
 
開發者ID:jiechic,項目名稱:sqlbrite-sqlcipher,代碼行數:18,代碼來源:BriteDatabaseTest.java

示例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());
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:20,代碼來源:SessionDao.java

示例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);
    }
}
 
開發者ID:ThirtyDegreesRay,項目名稱:OpenHub,代碼行數:26,代碼來源:LocalUserDao.java

示例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());
}
 
開發者ID:weixianshishen,項目名稱:LookWeather,代碼行數:17,代碼來源:CityDao.java

示例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();
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:20,代碼來源:Database.java

示例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);
}
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:18,代碼來源:PhotoItemDao.java

示例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);
}
 
開發者ID:ymqq,項目名稱:CommonFramework,代碼行數:22,代碼來源:SceneDao.java

示例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());
}
 
開發者ID:weixianshishen,項目名稱:LookWeather,代碼行數:16,代碼來源:ProvinceDao.java

示例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);
    }
}
 
開發者ID:ymqq,項目名稱:CommonFramework,代碼行數:16,代碼來源:BannerDao.java

示例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());
}
 
開發者ID:InnoFang,項目名稱:Android-Code-Demos,代碼行數:16,代碼來源:UserDao.java

示例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);
    }
}
 
開發者ID:bigjelly,項目名稱:ShaddockVideoPlayer,代碼行數:35,代碼來源:VideoInfoDao.java

示例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();
}
 
開發者ID:sarikaya,項目名稱:Bee-Analyzer,代碼行數:11,代碼來源:MapsActivity.java

示例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!");
}
 
開發者ID:peterdestasio,項目名稱:Geoclick,代碼行數:20,代碼來源:DBHelper.java

示例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());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:SimpleEntityNotNullDao.java


注:本文中的android.database.sqlite.SQLiteStatement.bindString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。