예제 #1
0
  private void readDatabass() {
    db.open(true);
    Cursor c = db.read("SELECT * FROM classlist WHERE classname = '" + packageName + "'");

    if (c.getCount() == 0) {
      db.close();
      db.open(false);
      db.write("INSERT INTO classlist values(null, '" + packageName + "', 1, 1)");
      db.close();
      db.open(true);
      c = db.read("SELECT * FROM classlist WHERE classname = '" + packageName + "'");
    }

    askable = Inttoboolean(c.getInt(3));
    usable = Inttoboolean(c.getInt(2));

    db.close();
    c.close();
  }
예제 #2
0
 public ArrayList<classes> setList() {
   ArrayList<classes> res = new ArrayList<classes>();
   int index = 0;
   db.open(true);
   Cursor c = db.read("SELECT * FROM classlist");
   db.close();
   buffer = new boolean[c.getCount()]; // 초기 boolean 값 저장
   while (c.isAfterLast() == false) {
     classes Data =
         new classes(c.getString(1), Inttoboolean(c.getInt(3)), Inttoboolean(c.getInt(2)));
     res.add(Data);
     buffer[index++] = Data.isChecked();
     c.moveToNext();
   }
   c.close();
   return res;
 }