如何搜索int而不是字符串,sqlite数据库,android
我想在数据库表中搜索具有int值(而不是字符串值)的行,但执行此操作时会出现错误。因此,我希望我能做到这一点,但这是不可能的:如何搜索int而不是字符串,sqlite数据库,android,android,sqlite,Android,Sqlite,我想在数据库表中搜索具有int值(而不是字符串值)的行,但执行此操作时会出现错误。因此,我希望我能做到这一点,但这是不可能的: updateRow(int titleCode, int questionCode, int inspectionResult){ 因此,我不得不面对这个问题 updateRow(String titleCode, String questionCode, int inspectionResult){ 如何使用这样的选择参数 new String[]{ti
updateRow(int titleCode, int questionCode, int inspectionResult){
因此,我不得不面对这个问题
updateRow(String titleCode, String questionCode, int inspectionResult){
如何使用这样的选择参数
new String[]{titleCode, questionCode}
如果这些变量是int/integer而不是字符串,是否要搜索titleCode和questionCode
由于无法将选择参数数组从字符串类型更改为int类型,因此我希望在数据库表中搜索int值
public void updateRow(String titleCode, String questionCode, int inspectionResult){
ContentValues contentValues = new ContentValues();
String selection = "INSPECTION_PLACE_CODE = ? AND INSPECTION_ITEM_CODE = ?";
contentValues.put(INSPECTION_RESULT_JUDGEMENT, inspectionResult);
sqLiteDatabase.update(DETAILS_TRAN_SMALL_INSPECTION_RESULTS, contentValues, selection,
new String[]{titleCode, questionCode});
}
根据第3.3节,比较(包括相等性检查)受类型关联的影响。您可以安全地在SQLite中将int值作为字符串进行测试,因为数据库驱动程序将在比较之前自动将字符串转换为int