我想检查数据库中是否存在几个值。如果是这样,则如果光标为空,该方法应返回 TRUE 或 FALSE。但问题是,尽管值不在数据库中,但它始终返回 TRUE!我错过了什么?
// This method check if the combination image path and contact name already exists in database
public boolean checkContentDatabase(String imageFilePath, String contactName) {
String query = "Select * from " + DB_TABLE+ " where " + TABLE_IMAGE_PATH + "='" + imageFilePath + "' and " + TABLE_CONTACT_NAME + "='" + contactName +"' ;";
Cursor c = db.rawQuery(query, null);
if(c != null) // Exists in database
{
return true;
}
else
{
return false;
}
}