Java Code Examples for android.database.sqlite.SQLiteStatement#clearBindings()

The following examples show how to use android.database.sqlite.SQLiteStatement#clearBindings() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CourseGroupDao.java    From ClassSchedule with Apache License 2.0 7 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, CourseGroup entity) {
    stmt.clearBindings();
 
    Long cgId = entity.getCgId();
    if (cgId != null) {
        stmt.bindLong(1, cgId);
    }
 
    String cgName = entity.getCgName();
    if (cgName != null) {
        stmt.bindString(2, cgName);
    }
 
    String cgSchool = entity.getCgSchool();
    if (cgSchool != null) {
        stmt.bindString(3, cgSchool);
    }
}
 
Example 2
Source File: FreshNewsCacheDao.java    From JianDanRxJava with Apache License 2.0 6 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, FreshNewsCache entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String result = entity.getResult();
    if (result != null) {
        stmt.bindString(2, result);
    }
 
    Integer page = entity.getPage();
    if (page != null) {
        stmt.bindLong(3, page);
    }
 
    Long time = entity.getTime();
    if (time != null) {
        stmt.bindLong(4, time);
    }
}
 
Example 3
Source File: Green_TimeLineStatusDao.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @inheritdoc
 */
@Override
protected void bindValues(SQLiteStatement stmt, Green_TimeLineStatus entity) {
    stmt.clearBindings();

    Integer _id = entity.get_id();
    if (_id != null) {
        stmt.bindLong(1, _id);
    }

    String accountid = entity.getAccountid();
    if (accountid != null) {
        stmt.bindString(2, accountid);
    }

    String mblogid = entity.getMblogid();
    if (mblogid != null) {
        stmt.bindString(3, mblogid);
    }

    String json = entity.getJson();
    if (json != null) {
        stmt.bindString(4, json);
    }
}
 
Example 4
Source File: ContactDao.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, Contact 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);
    }
 
    String email = entity.getEmail();
    if (email != null) {
        stmt.bindString(3, email);
    }
}
 
Example 5
Source File: LetterDao.java    From ml-authentication with Apache License 2.0 6 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, Letter entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
    stmt.bindString(2, localeConverter.convertToDatabaseValue(entity.getLocale()));
 
    Calendar timeLastUpdate = entity.getTimeLastUpdate();
    if (timeLastUpdate != null) {
        stmt.bindLong(3, timeLastUpdateConverter.convertToDatabaseValue(timeLastUpdate));
    }
    stmt.bindLong(4, entity.getRevisionNumber());
    stmt.bindString(5, contentStatusConverter.convertToDatabaseValue(entity.getContentStatus()));
    stmt.bindString(6, entity.getText());
    stmt.bindLong(7, entity.getUsageCount());
}
 
Example 6
Source File: SQLiteTemplate.java    From tedroid with Apache License 2.0 6 votes vote down vote up
/**
 * Ejecuta varias sentencias SQL (INSERT, UPDATE, DELETE, etc.) en la base de datos usando una
 * misma transacción.
 * 
 * @param sql las sentencia SQL a ejecutar.
 * @param statementBinder el objeto que reemplazarán los '?' de la sentencia varias veces.
 */
void batchExecute(String sql, BatchSQLiteStatementBinder statementBinder) {
    SQLiteDatabase database = null;
    SQLiteStatement statement = null;
    try {
        database = databaseHelper.getWritableDatabase();
        database.beginTransaction();
        statement = database.compileStatement(sql);
        for (int i = 0; i < statementBinder.getBatchSize(); i++) {
            statement.clearBindings();
            statementBinder.bindValues(statement, i);
            statement.execute();
        }
        database.setTransactionSuccessful();
    } catch (Exception ex) {
        Log.e(TAG, "Couldn't execute batch [" + sql + "]", ex);
    } finally {
        SQLiteUtils.close(statement);
        SQLiteUtils.endTransaction(database);
        SQLiteUtils.close(database);
    }
}
 
Example 7
Source File: VideoCacheDao.java    From JianDan_OkHttpWithVolley with Apache License 2.0 6 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, VideoCache entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String result = entity.getResult();
    if (result != null) {
        stmt.bindString(2, result);
    }
 
    Integer page = entity.getPage();
    if (page != null) {
        stmt.bindLong(3, page);
    }
 
    Long time = entity.getTime();
    if (time != null) {
        stmt.bindLong(4, time);
    }
}
 
Example 8
Source File: PrinterDbEntityDao.java    From octoandroid with GNU General Public License v3.0 5 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, PrinterDbEntity entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
    stmt.bindString(2, entity.getName());
    stmt.bindString(3, entity.getApiKey());
    stmt.bindString(4, entity.getScheme());
    stmt.bindString(5, entity.getHost());
    stmt.bindLong(6, entity.getPort());
    stmt.bindString(7, entity.getWebsocketPath());
    stmt.bindString(8, entity.getWebcamPathQuery());
    stmt.bindString(9, entity.getUploadLocation());
 
    String versionJson = entity.getVersionJson();
    if (versionJson != null) {
        stmt.bindString(10, versionJson);
    }
 
    String connectionJson = entity.getConnectionJson();
    if (connectionJson != null) {
        stmt.bindString(11, connectionJson);
    }
 
    String printerStateJson = entity.getPrinterStateJson();
    if (printerStateJson != null) {
        stmt.bindString(12, printerStateJson);
    }
 
    String filesJson = entity.getFilesJson();
    if (filesJson != null) {
        stmt.bindString(13, filesJson);
    }
}
 
Example 9
Source File: ReplaceRuleBeanDao.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, ReplaceRuleBean entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String replaceSummary = entity.getReplaceSummary();
    if (replaceSummary != null) {
        stmt.bindString(2, replaceSummary);
    }
 
    String regex = entity.getRegex();
    if (regex != null) {
        stmt.bindString(3, regex);
    }
 
    String replacement = entity.getReplacement();
    if (replacement != null) {
        stmt.bindString(4, replacement);
    }
 
    String useTo = entity.getUseTo();
    if (useTo != null) {
        stmt.bindString(5, useTo);
    }
 
    Boolean enable = entity.getEnable();
    if (enable != null) {
        stmt.bindLong(6, enable ? 1L: 0L);
    }
    stmt.bindLong(7, entity.getSerialNumber());
 
    Boolean isRegex = entity.getIsRegex();
    if (isRegex != null) {
        stmt.bindLong(8, isRegex ? 1L: 0L);
    }
}
 
Example 10
Source File: GreenWatchedVideoDao.java    From Dota2Helper with Apache License 2.0 5 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, GreenWatchedVideo entity) {
    stmt.clearBindings();
 
    String videoyoukuvid = entity.getVideoyoukuvid();
    if (videoyoukuvid != null) {
        stmt.bindString(1, videoyoukuvid);
    }
 
    String videobackground = entity.getVideobackground();
    if (videobackground != null) {
        stmt.bindString(2, videobackground);
    }
 
    String videotitle = entity.getVideotitle();
    if (videotitle != null) {
        stmt.bindString(3, videotitle);
    }
 
    Long videowatchtime = entity.getVideowatchtime();
    if (videowatchtime != null) {
        stmt.bindLong(4, videowatchtime);
    }
 
    Integer videoduration = entity.getVideoduration();
    if (videoduration != null) {
        stmt.bindLong(5, videoduration);
    }
 
    Integer videoplaytime = entity.getVideoplaytime();
    if (videoplaytime != null) {
        stmt.bindLong(6, videoplaytime);
    }
 
    Boolean videoEnded = entity.getVideoEnded();
    if (videoEnded != null) {
        stmt.bindLong(7, videoEnded ? 1L: 0L);
    }
}
 
Example 11
Source File: BookmarkBeanDao.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, BookmarkBean entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String noteUrl = entity.getNoteUrl();
    if (noteUrl != null) {
        stmt.bindString(2, noteUrl);
    }
 
    String bookName = entity.getBookName();
    if (bookName != null) {
        stmt.bindString(3, bookName);
    }
 
    String chapterName = entity.getChapterName();
    if (chapterName != null) {
        stmt.bindString(4, chapterName);
    }
 
    Integer chapterIndex = entity.getChapterIndex();
    if (chapterIndex != null) {
        stmt.bindLong(5, chapterIndex);
    }
 
    Integer pageIndex = entity.getPageIndex();
    if (pageIndex != null) {
        stmt.bindLong(6, pageIndex);
    }
 
    String content = entity.getContent();
    if (content != null) {
        stmt.bindString(7, content);
    }
}
 
Example 12
Source File: SearchHistoryDataDao.java    From MaoWanAndoidClient with Apache License 2.0 5 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, SearchHistoryData entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    String data = entity.getData();
    if (data != null) {
        stmt.bindString(2, data);
    }
    stmt.bindLong(3, entity.getDate());
}
 
Example 13
Source File: TraceDao.java    From OpenHub with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, Trace entity) {
    stmt.clearBindings();
    stmt.bindString(1, entity.getId());
 
    String type = entity.getType();
    if (type != null) {
        stmt.bindString(2, type);
    }
 
    String userId = entity.getUserId();
    if (userId != null) {
        stmt.bindString(3, userId);
    }
 
    Long repoId = entity.getRepoId();
    if (repoId != null) {
        stmt.bindLong(4, repoId);
    }
 
    java.util.Date startTime = entity.getStartTime();
    if (startTime != null) {
        stmt.bindLong(5, startTime.getTime());
    }
 
    java.util.Date latestTime = entity.getLatestTime();
    if (latestTime != null) {
        stmt.bindLong(6, latestTime.getTime());
    }
 
    Integer traceNum = entity.getTraceNum();
    if (traceNum != null) {
        stmt.bindLong(7, traceNum);
    }
}
 
Example 14
Source File: DownloadsDB.java    From Alite with GNU General Public License v3.0 5 votes vote down vote up
public void updateDownloadCurrentBytes(final DownloadInfo di) {
    SQLiteStatement downloadCurrentBytes = getUpdateCurrentBytesStatement();
    downloadCurrentBytes.clearBindings();
    downloadCurrentBytes.bindLong(1, di.mCurrentBytes);
    downloadCurrentBytes.bindLong(2, di.mIndex);
    downloadCurrentBytes.execute();
}
 
Example 15
Source File: StudentImageFeatureDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, StudentImageFeature entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
    stmt.bindLong(2, timeCreatedConverter.convertToDatabaseValue(entity.getTimeCreated()));
    stmt.bindString(3, entity.getFeatureVector());
}
 
Example 16
Source File: StudentImageDao.java    From ml-authentication with Apache License 2.0 5 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, StudentImage entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
    stmt.bindLong(2, timeCollectedConverter.convertToDatabaseValue(entity.getTimeCollected()));
    stmt.bindString(3, entity.getImageFileUrl());
    stmt.bindLong(4, entity.getStudentImageFeatureId());
    stmt.bindLong(5, entity.getStudentImageCollectionEventId());
}
 
Example 17
Source File: DownloadsDB.java    From play-apk-expansion with Apache License 2.0 5 votes vote down vote up
public void updateDownloadCurrentBytes(final DownloadInfo di) {
    SQLiteStatement downloadCurrentBytes = getUpdateCurrentBytesStatement();
    downloadCurrentBytes.clearBindings();
    downloadCurrentBytes.bindLong(1, di.mCurrentBytes);
    downloadCurrentBytes.bindLong(2, di.mIndex);
    downloadCurrentBytes.execute();
}
 
Example 18
Source File: SqliteJobQueue.java    From Mover with Apache License 2.0 5 votes vote down vote up
private void delete(Long id) {
    SQLiteStatement stmt = sqlHelper.getDeleteStatement();
    synchronized (stmt) {
        stmt.clearBindings();
        stmt.bindLong(1, id);
        stmt.execute();
    }
}
 
Example 19
Source File: GroupEntityDao.java    From Android with MIT License 4 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, GroupEntity entity) {
    stmt.clearBindings();
 
    Long _id = entity.get_id();
    if (_id != null) {
        stmt.bindLong(1, _id);
    }
    stmt.bindString(2, entity.getIdentifier());
 
    String name = entity.getName();
    if (name != null) {
        stmt.bindString(3, name);
    }
 
    String ecdh_key = entity.getEcdh_key();
    if (ecdh_key != null) {
        stmt.bindString(4, ecdh_key);
    }
 
    Integer common = entity.getCommon();
    if (common != null) {
        stmt.bindLong(5, common);
    }
 
    Integer verify = entity.getVerify();
    if (verify != null) {
        stmt.bindLong(6, verify);
    }
 
    Integer pub = entity.getPub();
    if (pub != null) {
        stmt.bindLong(7, pub);
    }
 
    String avatar = entity.getAvatar();
    if (avatar != null) {
        stmt.bindString(8, avatar);
    }
 
    String summary = entity.getSummary();
    if (summary != null) {
        stmt.bindString(9, summary);
    }
}
 
Example 20
Source File: UserDao.java    From TLint with Apache License 2.0 4 votes vote down vote up
/**
 * @inheritdoc
 */
@Override
protected void bindValues(SQLiteStatement stmt, User entity) {
    stmt.clearBindings();

    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }

    String userName = entity.getUserName();
    if (userName != null) {
        stmt.bindString(2, userName);
    }

    String uid = entity.getUid();
    if (uid != null) {
        stmt.bindString(3, uid);
    }

    String token = entity.getToken();
    if (token != null) {
        stmt.bindString(4, token);
    }

    String icon = entity.getIcon();
    if (icon != null) {
        stmt.bindString(5, icon);
    }

    Integer sex = entity.getSex();
    if (sex != null) {
        stmt.bindLong(6, sex);
    }

    String cookie = entity.getCookie();
    if (cookie != null) {
        stmt.bindString(7, cookie);
    }

    String registerTime = entity.getRegisterTime();
    if (registerTime != null) {
        stmt.bindString(8, registerTime);
    }

    String location = entity.getLocation();
    if (location != null) {
        stmt.bindString(9, location);
    }

    String school = entity.getSchool();
    if (school != null) {
        stmt.bindString(10, school);
    }

    String threadUrl = entity.getThreadUrl();
    if (threadUrl != null) {
        stmt.bindString(11, threadUrl);
    }

    String postUrl = entity.getPostUrl();
    if (postUrl != null) {
        stmt.bindString(12, postUrl);
    }

    String nickNameUrl = entity.getNickNameUrl();
    if (nickNameUrl != null) {
        stmt.bindString(13, nickNameUrl);
    }
}