Example #1
0
  /** data follow by recordTime */
  public List<gtdContent> retrieveData() {
    StringBuilder bd = new StringBuilder();
    bd.append("select * from ")
        .append(GtdTable.TABLE_NAME)
        .append(" order by ")
        .append(GtdTable.ITEM_WRITTEN_MILLSECECOND)
        .append(" desc");
    Log.d("SQL_RETRIEVE", bd.toString());

    Cursor cursor = helper.find(bd.toString(), null);
    List<gtdContent> list = new ArrayList<gtdContent>(cursor.getCount());

    while (cursor.moveToNext()) {
      gtdContent _om = new gtdContent();
      _om.setSmsID(cursor.getInt(cursor.getColumnIndex(GtdTable.SMS_ID)));
      _om.setStartTime(cursor.getString(cursor.getColumnIndex(GtdTable.START_TIME)));
      _om.setEndTime(cursor.getString(cursor.getColumnIndex(GtdTable.END_TIME)));
      _om.setPlace(cursor.getString(cursor.getColumnIndex(GtdTable.PLACE)));
      _om.setContent(cursor.getString(cursor.getColumnIndex(GtdTable.CONTENT)));
      _om.setGtdStatus(cursor.getString(cursor.getColumnIndex(GtdTable.GTDSTATUS)));
      _om.setGtdType(cursor.getString(cursor.getColumnIndex(GtdTable.GTDTYPE)));
      _om.setWrite_time(cursor.getLong(cursor.getColumnIndex(GtdTable.ITEM_WRITTEN_MILLSECECOND)));
      Log.d("SQL_RETRIEVE", _om.getContent());
      list.add(_om);
    }
    return list;
  }
Example #2
0
  /** data follow by today tomorrow */
  public List<gtdContent> retrieveTime() {
    StringBuilder bd = new StringBuilder();
    bd.append("select * from ")
        .append(GtdTable.TABLE_NAME)
        .append(" where ")
        .append(GtdTable.GTDSTATUS)
        .append(" = ")
        .append("todo");
    Log.d("SQL_RETRIEVE", bd.toString());
    System.out.println(bd.toString());

    //        Cursor cursor = helper.find(bd.toString(), null);
    calendar = new CalendarDateBean();
    long todayBegin = calendar.getTodayBeginZero();
    long todayEnd = calendar.getTodayEndZero();
    Cursor cursor =
        helper.find(
            "select * from GTDTable where startTime<? and startTime>?",
            new String[] {
              String.valueOf(todayEnd), String.valueOf(todayBegin),
            });
    List<gtdContent> list = new ArrayList<gtdContent>(cursor.getCount());

    while (cursor.moveToNext()) {
      gtdContent _om = new gtdContent();
      _om.setSmsID(cursor.getInt(cursor.getColumnIndex(GtdTable.SMS_ID)));
      _om.setStartTime(cursor.getString(cursor.getColumnIndex(GtdTable.START_TIME)));
      _om.setEndTime(cursor.getString(cursor.getColumnIndex(GtdTable.END_TIME)));
      _om.setPlace(cursor.getString(cursor.getColumnIndex(GtdTable.PLACE)));
      _om.setContent(cursor.getString(cursor.getColumnIndex(GtdTable.CONTENT)));
      _om.setGtdStatus(cursor.getString(cursor.getColumnIndex(GtdTable.GTDSTATUS)));
      _om.setGtdType(cursor.getString(cursor.getColumnIndex(GtdTable.GTDTYPE)));
      _om.setWrite_time(cursor.getLong(cursor.getColumnIndex(GtdTable.ITEM_WRITTEN_MILLSECECOND)));
      Log.d("SQL_RETRIEVE", _om.getContent());
      list.add(_om);
    }
    return list;
  }