如何使用 greendao 从 TABLE_NAME 执行 SELECT dateTime
How do I execute SELECT dateTime FROM TABLE_NAME using greendao
如何使用 greendao 执行 SELECT dateTime FROM TABLE_NAME
。
我正在尝试从 table "TABLE_NAME.
获取库伦日期时间
要获取单个列,您需要使用原始查询
private static final String SQL_DISTINCT_DATE = "SELECT DISTINCT "+YourDao.Properties.EName.datetime+" FROM "+YourDao.TABLENAME;
public static List<String> listEName(DaoSession session) {
ArrayList<String> result = new ArrayList<String>();
Cursor c = session.getDatabase().rawQuery(SQL_DISTINCT_DATE, null);
try{
if (c.moveToFirst()) {
do {
result.add(c.getString(0));
} while (c.moveToNext());
}
} finally {
c.close();
}
return result;
}
如何使用 greendao 执行 SELECT dateTime FROM TABLE_NAME
。
我正在尝试从 table "TABLE_NAME.
获取库伦日期时间要获取单个列,您需要使用原始查询
private static final String SQL_DISTINCT_DATE = "SELECT DISTINCT "+YourDao.Properties.EName.datetime+" FROM "+YourDao.TABLENAME;
public static List<String> listEName(DaoSession session) {
ArrayList<String> result = new ArrayList<String>();
Cursor c = session.getDatabase().rawQuery(SQL_DISTINCT_DATE, null);
try{
if (c.moveToFirst()) {
do {
result.add(c.getString(0));
} while (c.moveToNext());
}
} finally {
c.close();
}
return result;
}