use of com.activeandroid.query.Select in project ActiveAndroid by pardom.
the class SelectTest method testSelectAll.
public void testSelectAll() {
assertSqlEquals("SELECT ALL * ", new Select().all());
assertSqlEquals("SELECT ALL * ", new Select().distinct().all());
}
use of com.activeandroid.query.Select in project xDrip by NightscoutFoundation.
the class UserError method bySeverity.
public static List<UserError> bySeverity(Integer[] levels) {
String levelsString = " ";
for (int level : levels) {
levelsString += level + ",";
}
Log.d("UserError", "severity in (" + levelsString.substring(0, levelsString.length() - 1) + ")");
return new Select().from(UserError.class).where("severity in (" + levelsString.substring(0, levelsString.length() - 1) + ")").orderBy("timestamp desc").limit(// too many data can kill akp
10000).execute();
}
use of com.activeandroid.query.Select in project xDrip by NightscoutFoundation.
the class PenData method getMissingIndex.
public static long getMissingIndex(final String mac) {
if (mac == null)
return -1;
final List<PenData> list = new Select().from(PenData.class).where("pen_mac = ?", mac).where("timestamp > ?", JoH.tsl() - Constants.WEEK_IN_MS).orderBy("idx desc").execute();
long got = -1;
for (final PenData pd : list) {
if (got != -1 && pd.index != got - 1) {
UserError.Log.d(TAG, "Tripped missing index on: " + got + " vs " + pd.index);
return got - 1;
}
got = pd.index;
}
return -1;
}
use of com.activeandroid.query.Select in project xDrip by NightscoutFoundation.
the class DBSearchUtil method noReadingsBelowRange.
public static int noReadingsBelowRange(Context context) {
Bounds bounds = new Bounds().invoke();
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
boolean mgdl = "mgdl".equals(settings.getString("units", "mgdl"));
double low = Double.parseDouble(settings.getString("lowValue", "70"));
if (!mgdl) {
low *= Constants.MMOLL_TO_MGDL;
}
int count = new Select().from(BgReading.class).where("timestamp >= " + bounds.start).where("timestamp <= " + bounds.stop).where("calculated_value > " + CUTOFF).where("calculated_value < " + low).where("snyced == 0").count();
Log.d("DrawStats", "Low count: " + count);
return count;
}
use of com.activeandroid.query.Select in project xDrip by NightscoutFoundation.
the class DBSearchUtil method noReadingsInRange.
public static int noReadingsInRange(Context context) {
Bounds bounds = new Bounds().invoke();
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
boolean mgdl = "mgdl".equals(settings.getString("units", "mgdl"));
double high = Double.parseDouble(settings.getString("highValue", "170"));
double low = Double.parseDouble(settings.getString("lowValue", "70"));
if (!mgdl) {
high *= Constants.MMOLL_TO_MGDL;
low *= Constants.MMOLL_TO_MGDL;
}
int count = new Select().from(BgReading.class).where("timestamp >= " + bounds.start).where("timestamp <= " + bounds.stop).where("calculated_value > " + CUTOFF).where("calculated_value <= " + high).where("calculated_value >= " + low).where("snyced == 0").count();
Log.d("DrawStats", "In count: " + count);
return count;
}
Aggregations