Esempio n. 1
0
 /**
  * Retrieve an IP address for a specific device from the database
  *
  * @param mac The MAC address of the device being searched for
  * @return Either the IP of a found device, or null if not found
  */
 protected String getDeviceIP(String mac) {
   String addr = null;
   SQLiteDatabase db = mDatabaseH.getReadableDatabase();
   Cursor data =
       db.query(
           DatabaseHelper.DATABASE_TABLE,
           DatabaseHelper.DATABASE_FIELDS,
           DatabaseHelper.DATABASE_MAC + "= ?",
           new String[] {mac},
           null,
           null,
           null);
   if (data.moveToFirst()) {
     addr = data.getString(1);
   }
   return addr;
 }
Esempio n. 2
0
        @Override
        public ArrayList<String[]> getClients() {
          ArrayList<String[]> array = new ArrayList<String[]>(5);
          SQLiteDatabase db = mDatabaseH.getReadableDatabase();
          Cursor cr =
              db.query(
                  DatabaseHelper.DATABASE_TABLE,
                  DatabaseHelper.DATABASE_FIELDS,
                  null,
                  null,
                  null,
                  null,
                  null);

          if (cr.moveToFirst()) {
            do {
              String[] g = {cr.getString(0), cr.getString(1)};
              array.add(g);
            } while (cr.moveToNext());
          }

          return array;
        }
Esempio n. 3
0
 @Override
 public int size() {
   SQLiteDatabase db = mDatabaseH.getReadableDatabase();
   return (int) DatabaseUtils.queryNumEntries(db, DatabaseHelper.DATABASE_TABLE);
 }