mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-10-22 22:15:11 -04:00
Show warning when no matches
This commit is contained in:
1 parent
e048fdff59
commit
21a8dc6867
4 files changed
+43
No files matched your search
@@ -175,5 +175,29 @@ public class DBHelper extends SQLiteOpenHelper
|
||||
|
||||
return numItems;
|
||||
}
|
||||
|
||||
public int getFilteredLoyaltyCardCount(String filter)
|
||||
{
|
||||
String actualFilter = String.format("%%%s%%", filter);
|
||||
String[] selectionArgs = { actualFilter, actualFilter };
|
||||
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
Cursor data = db.rawQuery("SELECT Count(*) FROM " + LoyaltyCardDbIds.TABLE +
|
||||
" WHERE " + LoyaltyCardDbIds.STORE + " LIKE ? " +
|
||||
" OR " + LoyaltyCardDbIds.NOTE + " LIKE ? "
|
||||
, selectionArgs, null);
|
||||
|
||||
int numItems = 0;
|
||||
|
||||
if(data.getCount() == 1)
|
||||
{
|
||||
data.moveToFirst();
|
||||
numItems = data.getInt(0);
|
||||
}
|
||||
|
||||
data.close();
|
||||
|
||||
return numItems;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user