/**
   * 获取所有分组列表
   *
   * @return
   */
  public Vector<ReceiveMessage> getMessageList() {
    messagelist.removeAllElements();
    try {
      String[] cols = new String[] {MESSAGE_TEXT, MESSAGE_STATE, RECEIVE_TIME};
      if (db.isTableExits(db.getConnection(), MESSAGE_DB)) {

      } else {
        initMessageTable();
      }
      System.out.println("table  name" + MESSAGE_DB);
      Cursor cursor = db.getConnection().query(MESSAGE_DB, cols, null, null, null, null, null);
      while (cursor.moveToNext()) {
        ReceiveMessage msg = new ReceiveMessage();
        msg.message = cursor.getString(cursor.getColumnIndex(MESSAGE_TEXT));
        msg.state = Integer.parseInt(cursor.getString(cursor.getColumnIndex(MESSAGE_STATE)));
        msg.time = cursor.getString(cursor.getColumnIndex(RECEIVE_TIME));
        messagelist.add(msg);
      }

      cursor.close();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (db.getConnection().isOpen()) {
        db.closeConnection(db.getConnection());
      }
    }
    return this.messagelist;
  }
  public MessageTableManager(Context context, String time) {
    db = new BaseDB(context);
    time = time.replaceAll("-", "_"); // 数据库名不用有特殊符号和中文,因此先做替换操作
    MESSAGE_DB = MESSAGE_DB + "_" + time.substring(0, 10); // 将日期截取做为表名,如2011_06_10
    isNewInstall = true;
    try {
      if (db.isTableExits(db.getConnection(), MESSAGE_DB)) {
        Cursor cursor =
            db.getConnection()
                .query(
                    MESSAGE_DB,
                    new String[] {MESSAGE_STATE, MESSAGE_TEXT, RECEIVE_TIME},
                    null,
                    null,
                    null,
                    null,
                    null);
        if (cursor != null) {
          while (cursor.moveToNext()) {
            isNewInstall = false;
          }
        }
        cursor.close();
        db.closeConnection(db.getConnection());
      }
      if (isNewInstall) {

        initMessageTable();
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (db.getConnection().isOpen()) {
        db.closeConnection(db.getConnection());
      }
    }
  }