コード例 #1
0
  private void show2() {
    //		final String INIT_TABLE = "CREATE TABLE " + TABLE_NAME + " (" +_ID + " INTEGER PRIMARY KEY
    // AUTOINCREMENT, " + name + " CHAR, "
    //				+ relationship + " CHAR, "+ remarks + " CHAR, "+ filepath + " CHAR, "+ phone + " CHAR, " +
    // email + " CHAR);";
    SQLiteDatabase db = dbhelper.getReadableDatabase();
    Cursor cursor =
        db.rawQuery(
            "select "
                + MyDBHelper_game2.marks
                + ","
                + MyDBHelper_game2.date
                + " from "
                + MyDBHelper_game2.TABLE_NAME
                + " ORDER BY "
                + MyDBHelper_game2.marks
                + " DESC "
                + "LIMIT 10;",
            null);
    cursor.moveToFirst();
    for (int i = 0; i < cursor.getCount(); i++) {

      marklist.add(cursor.getInt(0));
      daylist.add(cursor.getString(1));
      cursor.moveToNext();
    }

    cursor.close();

    //			list.add(temp);

  }
コード例 #2
0
  private Cursor getCursor() {

    SQLiteDatabase db = dbhelper.getReadableDatabase();

    //		String[] columns = { android.provider.BaseColumns._ID,MyDBHelper_game5.diff,
    // MyDBHelper_game5.marks, MyDBHelper_game5.numofq};
    Log.d(
        "",
        "select count(*) from "
            + MyDBHelper_game2.TABLE_NAME
            + " where '"
            + MyDBHelper_game2.marks
            + "' >= "
            + Global.totalscore
            + ";");
    //		Cursor cursor = db.query(MyDBHelper_game5.TABLE_NAME, columns, null, null, null, null,
    // MyDBHelper_game5.marks);
    Cursor cursor =
        db.rawQuery(
            "select count(*) from "
                + MyDBHelper_game2.TABLE_NAME
                + " where "
                + MyDBHelper_game2.marks
                + " >= "
                + Global.totalscore
                + " and "
                + MyDBHelper_game2.userid
                + " = '"
                + Global.s.userid()
                + "';",
            null);

    // db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy)
    //		getActivity().startManagingCursor(cursor);

    return cursor;
  }