private SQLiteQueryBuilder getCursorQueryBuilder(String tables) { SQLiteQueryBuilder builder = new SQLiteQueryBuilder(); builder.setTables(tables); builder.appendWhere(CacheHelper.PAGE_LANGUAGE + " = " + String.valueOf(mLanguage.getId())); builder.appendWhere( " AND " + CacheHelper.PAGE_LOCATION + " = " + String.valueOf(mLocation.getId())); builder.appendWhere( " AND " + CacheHelper.PAGE_STATUS + " != " + Helper.quote(PAGE_STATUS_TRASH)); builder.appendWhere(" AND " + CacheHelper.PAGE_TYPE + " = " + Helper.quote(getType())); return builder; }
public long getLastModificationDate() { long time = 0; String query = "SELECT max(" + CacheHelper.PAGE_MODIFIED + ") FROM " + CacheHelper.TABLE_PAGE + " WHERE " + CacheHelper.PAGE_LANGUAGE + "=" + String.valueOf(mLanguage.getId()) + " AND " + CacheHelper.PAGE_LOCATION + "=" + String.valueOf(mLocation.getId()) + " AND " + CacheHelper.PAGE_TYPE + "=" + Helper.quote(getType()); Cursor cursor = mCache.executeRawQuery(query, null); if (cursor != null) { try { if (cursor.moveToFirst()) { time = cursor.getLong(0); } } finally { cursor.close(); } } return time; }