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

The following examples show how to use android.database.sqlite.SQLiteStatement#bindString() . 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: 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 3
Source File: UseAreaDao.java    From MyWeather with Apache License 2.0 6 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, UseArea entity) {
    stmt.clearBindings();
 
    String areaid = entity.getAreaid();
    if (areaid != null) {
        stmt.bindString(1, areaid);
    }
 
    String areaid2345 = entity.getAreaid2345();
    if (areaid2345 != null) {
        stmt.bindString(2, areaid2345);
    }
 
    String areaName = entity.getAreaName();
    if (areaName != null) {
        stmt.bindString(3, areaName);
    }
 
    Boolean main = entity.getMain();
    if (main != null) {
        stmt.bindLong(4, main ? 1L: 0L);
    }
}
 
Example 4
Source File: GroupUsersDao.java    From CoolChat with Apache License 2.0 6 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, GroupUsers entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
    stmt.bindLong(2, entity.getUserId());
 
    String userName = entity.getUserName();
    if (userName != null) {
        stmt.bindString(3, userName);
    }
 
    String userAvatar = entity.getUserAvatar();
    if (userAvatar != null) {
        stmt.bindString(4, userAvatar);
    }
 
    String userSex = entity.getUserSex();
    if (userSex != null) {
        stmt.bindString(5, userSex);
    }
}
 
Example 5
Source File: JokeCacheDao.java    From JianDan with Apache License 2.0 6 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, JokeCache 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 6
Source File: alloperatorsDao.java    From RxJavaApp with Apache License 2.0 6 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, alloperators entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
    stmt.bindString(2, entity.getName());
    stmt.bindString(3, entity.getThread());
    stmt.bindString(4, entity.getDesc());
    stmt.bindString(5, entity.getImg());
    stmt.bindString(6, entity.getUrl());
 
    Long operators_id = entity.getOperators_id();
    if (operators_id != null) {
        stmt.bindLong(7, operators_id);
    }
}
 
Example 7
Source File: FreshNewsCacheDao.java    From JianDan_OkHttp 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 8
Source File: CollectEntityDao.java    From MeiZiNews with MIT License 6 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, CollectEntity entity) {
    stmt.clearBindings();
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id);
    }
 
    Long html_id = entity.getHtml_id();
    if (html_id != null) {
        stmt.bindLong(2, html_id);
    }
 
    String collect = entity.getCollect();
    if (collect != null) {
        stmt.bindString(3, collect);
    }
}
 
Example 9
Source File: StoryBookDao.java    From ml-authentication with Apache License 2.0 6 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, StoryBook 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.getTitle());
    stmt.bindLong(7, entity.getCoverImageId());
    stmt.bindString(8, gradeLevelConverter.convertToDatabaseValue(entity.getGradeLevel()));
}
 
Example 10
Source File: MessageDao.java    From sctalk with Apache License 2.0 6 votes vote down vote up
/** @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());
}
 
Example 11
Source File: UserDao.java    From android-orm-benchmark-updated with Apache License 2.0 6 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, User entity) {
    stmt.clearBindings();
 
    String last_name = entity.getLast_name();
    if (last_name != null) {
        stmt.bindString(1, last_name);
    }
 
    String first_name = entity.getFirst_name();
    if (first_name != null) {
        stmt.bindString(2, first_name);
    }
 
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(3, id);
    }
}
 
Example 12
Source File: WordDao.java    From ml-authentication with Apache License 2.0 6 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, Word 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.bindString(7, entity.getPhonetics());
    stmt.bindLong(8, entity.getUsageCount());
 
    SpellingConsistency spellingConsistency = entity.getSpellingConsistency();
    if (spellingConsistency != null) {
        stmt.bindString(9, spellingConsistencyConverter.convertToDatabaseValue(spellingConsistency));
    }
}
 
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: CookieBeanDao.java    From HaoReader with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, CookieBean entity) {
    stmt.clearBindings();
 
    String url = entity.getUrl();
    if (url != null) {
        stmt.bindString(1, url);
    }
 
    String cookie = entity.getCookie();
    if (cookie != null) {
        stmt.bindString(2, cookie);
    }
}
 
Example 15
Source File: MediaDownloadInfoDao.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public final void bindValues(SQLiteStatement stmt, MediaDownloadInfo entity) {
    stmt.clearBindings();
    Long id = entity.getId();
    if (id != null) {
        stmt.bindLong(1, id.longValue());
    }
    stmt.bindLong(2, entity.getStartPos());
    stmt.bindLong(3, entity.getEndPos());
    stmt.bindLong(4, entity.getCompeleteZize());
    String url = entity.getUrl();
    if (url != null) {
        stmt.bindString(5, url);
    }
}
 
Example 16
Source File: ForumDao.java    From TLint with Apache License 2.0 4 votes vote down vote up
/**
 * @inheritdoc
 */
@Override
protected void bindValues(SQLiteStatement stmt, Forum entity) {
    stmt.clearBindings();

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

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

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

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

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

    String backImg = entity.getBackImg();
    if (backImg != null) {
        stmt.bindString(6, backImg);
    }

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

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

    Integer weight = entity.getWeight();
    if (weight != null) {
        stmt.bindLong(9, weight);
    }
}
 
Example 17
Source File: RealWeatherDao.java    From FoodOrdering with Apache License 2.0 4 votes vote down vote up
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, RealWeather entity) {
    stmt.clearBindings();
 
    String areaid = entity.getAreaid();
    if (areaid != null) {
        stmt.bindString(1, areaid);
    }
 
    String areaName = entity.getAreaName();
    if (areaName != null) {
        stmt.bindString(2, areaName);
    }
 
    String weatherCondition = entity.getWeatherCondition();
    if (weatherCondition != null) {
        stmt.bindString(3, weatherCondition);
    }
 
    String fx = entity.getFx();
    if (fx != null) {
        stmt.bindString(4, fx);
    }
 
    String fj = entity.getFj();
    if (fj != null) {
        stmt.bindString(5, fj);
    }
 
    Integer temp = entity.getTemp();
    if (temp != null) {
        stmt.bindLong(6, temp);
    }
 
    Integer feeltemp = entity.getFeeltemp();
    if (feeltemp != null) {
        stmt.bindLong(7, feeltemp);
    }
 
    Integer shidu = entity.getShidu();
    if (shidu != null) {
        stmt.bindLong(8, shidu);
    }
 
    String sunrise = entity.getSunrise();
    if (sunrise != null) {
        stmt.bindString(9, sunrise);
    }
 
    String sundown = entity.getSundown();
    if (sundown != null) {
        stmt.bindString(10, sundown);
    }
 
    java.util.Date lastUpdate = entity.getLastUpdate();
    if (lastUpdate != null) {
        stmt.bindLong(11, lastUpdate.getTime());
    }
}
 
Example 18
Source File: AllophoneDao.java    From ml-authentication with Apache License 2.0 4 votes vote down vote up
@Override
protected final void bindValues(SQLiteStatement stmt, Allophone 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.getValueIpa());
    stmt.bindString(7, entity.getValueSampa());
    stmt.bindLong(8, entity.getDiacritic() ? 1L: 0L);
 
    SoundType soundType = entity.getSoundType();
    if (soundType != null) {
        stmt.bindString(9, soundTypeConverter.convertToDatabaseValue(soundType));
    }
 
    VowelLength vowelLength = entity.getVowelLength();
    if (vowelLength != null) {
        stmt.bindString(10, vowelLengthConverter.convertToDatabaseValue(vowelLength));
    }
 
    VowelHeight vowelHeight = entity.getVowelHeight();
    if (vowelHeight != null) {
        stmt.bindString(11, vowelHeightConverter.convertToDatabaseValue(vowelHeight));
    }
 
    VowelFrontness vowelFrontness = entity.getVowelFrontness();
    if (vowelFrontness != null) {
        stmt.bindString(12, vowelFrontnessConverter.convertToDatabaseValue(vowelFrontness));
    }
 
    LipRounding lipRounding = entity.getLipRounding();
    if (lipRounding != null) {
        stmt.bindString(13, lipRoundingConverter.convertToDatabaseValue(lipRounding));
    }
 
    ConsonantType consonantType = entity.getConsonantType();
    if (consonantType != null) {
        stmt.bindString(14, consonantTypeConverter.convertToDatabaseValue(consonantType));
    }
 
    ConsonantPlace consonantPlace = entity.getConsonantPlace();
    if (consonantPlace != null) {
        stmt.bindString(15, consonantPlaceConverter.convertToDatabaseValue(consonantPlace));
    }
 
    ConsonantVoicing consonantVoicing = entity.getConsonantVoicing();
    if (consonantVoicing != null) {
        stmt.bindString(16, consonantVoicingConverter.convertToDatabaseValue(consonantVoicing));
    }
    stmt.bindLong(17, entity.getUsageCount());
}
 
Example 19
Source File: Green_AccountBeanDao.java    From iBeebo with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @inheritdoc
 */
@Override
protected void bindValues(SQLiteStatement stmt, Green_AccountBean entity) {
    stmt.clearBindings();

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

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

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

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

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

    Long oauth_token_expires_time = entity.getOauth_token_expires_time();
    if (oauth_token_expires_time != null) {
        stmt.bindLong(6, oauth_token_expires_time);
    }

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

    Long expires_time_hack = entity.getExpires_time_hack();
    if (expires_time_hack != null) {
        stmt.bindLong(8, expires_time_hack);
    }

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

    Integer navigation_position = entity.getNavigation_position();
    if (navigation_position != null) {
        stmt.bindLong(10, navigation_position);
    }

    String user_info_json = entity.getUser_info_json();
    if (user_info_json != null) {
        stmt.bindString(11, user_info_json);
    }
}
 
Example 20
Source File: FileEntryDao.java    From AppManager-for-Android with Apache License 2.0 4 votes vote down vote up
public void create(final FileEntry entity) {
    if (entity == null) {
        return;
    }
    SQLiteDatabase db = null;
    SQLiteStatement statement = null;
    try {
        DbHelper helper = new DbHelper(getContext());
        db = helper.getWritableDatabase();
        StringBuilder sb = new StringBuilder();
        sb.append("INSERT INTO file_entries (");
        sb.append(" name, ");
        sb.append(" url, ");
        sb.append(" basic_auth_user, ");
        sb.append(" basic_auth_password, ");
        sb.append(" created_at, ");
        sb.append(" updated_at");
        sb.append(") VALUES (");
        sb.append(" ?, "); // name
        sb.append(" ?, "); // url
        if (entity.basicAuthUser != null) {
            sb.append(" ?, "); // basic_auth_user
        }
        if (entity.basicAuthPassword != null) {
            sb.append(" ?, "); // basic_auth_password
        }
        sb.append("DATETIME('now', 'localtime'), "); // created_at
        sb.append("DATETIME('now', 'localtime')"); // updated_at
        sb.append(");");
        statement = db.compileStatement(sb.toString());
        int index = 1;
        statement.bindString(index++, entity.name);
        statement.bindString(index++, entity.url);
        if (entity.basicAuthUser != null) {
            statement.bindString(index++, entity.basicAuthUser);
        }
        if (entity.basicAuthPassword != null) {
            statement.bindString(index++, entity.basicAuthPassword);
        }
        statement.executeInsert();
    } finally {
        if (statement != null) {
            statement.close();
        }
        if (db != null) {
            db.close();
        }
    }
}