Exemplo n.º 1
0
 public RecordInfo query(int recordId) {
   Cursor cursor =
       db.rawQuery(
           "select * from record where recordId = ?", new String[] {String.valueOf(recordId)});
   RecordInfo record = null;
   if (cursor.moveToFirst()) {
     record = getInfo(cursor);
   } else {
     record = new RecordInfo();
   }
   return record;
 }
Exemplo n.º 2
0
 public RecordInfo querySiteRecord(int siteId) {
   Cursor cursor =
       db.rawQuery(
           "select * from record where siteId = ? order by recordId desc limit 1",
           new String[] {String.valueOf(siteId)});
   RecordInfo record = null;
   if (cursor.moveToFirst()) {
     record = getInfo(cursor);
   } else {
     record = new RecordInfo();
   }
   return record;
 }
Exemplo n.º 3
0
  public ArrayList<RecordInfo> querySiteAllRecord(int siteId, int pageSize, int page) {
    int start = (page - 1) * pageSize;
    Cursor cursor =
        db.rawQuery(
            "select * from record where siteId = ? order by recordId desc limit ? offset ?",
            new String[] {String.valueOf(siteId), String.valueOf(pageSize), String.valueOf(start)});
    ArrayList<RecordInfo> list = new ArrayList<RecordInfo>();

    for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
      list.add(getInfo(cursor));
    }

    return list;
  }