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


Java SQLiteStatement.clearBindings方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:lpy19930103,項目名稱:MinimalismJotter,代碼行數:21,代碼來源:TagDao.java

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

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

示例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);
    }
}
 
開發者ID:MobileDev418,項目名稱:chat-sdk-android-push-firebase,代碼行數:26,代碼來源:BLinkedAccountDao.java

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

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

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

示例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();
        }
    }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:38,代碼來源:DefaultWXStorage.java

示例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);
    }
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:41,代碼來源:UserDao.java

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

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

示例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);
    }
}
 
開發者ID:jansipke,項目名稱:pvdisplay,代碼行數:32,代碼來源:PvDataOperations.java

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

示例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();
}
 
開發者ID:shevart,項目名稱:Android-SQLite-Master-Project,代碼行數:10,代碼來源:UserDao.java

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


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