コード例 #1
0
 public List<Cellular> readCellular(int groupId) {
   List<Cellular> list;
   Cursor cursor = null;
   try {
     cursor =
         getReadableDatabase()
             .rawQuery(
                 "SELECT id, mcc, mnc, lac, cid, lat, lon, status, cellgroup FROM CELLULAR where cellgroup="
                     + groupId,
                 null);
     list = new ArrayList<>(cursor.getCount());
     if (cursor.getCount() > 0) {
       cursor.moveToFirst();
       do {
         Cellular p =
             new Cellular(
                 cursor.getInt(1),
                 cursor.getInt(2),
                 cursor.getInt(3),
                 cursor.getInt(4),
                 cursor.getDouble(5),
                 cursor.getDouble(6),
                 cursor.getInt(7),
                 cursor.getInt(8));
         p.setId(cursor.getInt(0));
         list.add(p);
       } while (cursor.moveToNext());
     }
   } finally {
     if (cursor != null) {
       cursor.close();
     }
   }
   return list;
 }
コード例 #2
0
 public List<Cellular> readCellular(String type) {
   List<Cellular> list;
   Cursor cursor = null;
   try {
     cursor =
         getReadableDatabase()
             .rawQuery(
                 "SELECT c.id, c.mcc, c.mnc, c.lac, c.cid, c.lat, c.lon, c.status, c.cellgroup FROM CELLULAR c, CELL_GROUP g where c.cellgroup = g.id and g.status = "
                     + CellGroup.STATUS.ENABLED.getValue()
                     + " and g.type='"
                     + type
                     + "'",
                 null);
     list = new ArrayList<>(cursor.getCount());
     if (cursor.getCount() > 0) {
       cursor.moveToFirst();
       do {
         Cellular p =
             new Cellular(
                 cursor.getInt(1),
                 cursor.getInt(2),
                 cursor.getInt(3),
                 cursor.getInt(4),
                 cursor.getDouble(5),
                 cursor.getDouble(6),
                 cursor.getInt(7),
                 cursor.getInt(8));
         p.setId(cursor.getInt(0));
         list.add(p);
       } while (cursor.moveToNext());
     }
   } finally {
     if (cursor != null) {
       cursor.close();
     }
   }
   return list;
 }