예제 #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 long addOrUpdateCellular(Cellular cellular) {
   ContentValues content = new ContentValues();
   content.put("cid", cellular.getCid());
   content.put("lac", cellular.getLac());
   content.put("mcc", cellular.getMcc());
   content.put("mnc", cellular.getMnc());
   content.put("cellgroup", cellular.getCellGroup());
   content.put("lat", cellular.getLat());
   content.put("lon", cellular.getLon());
   content.put("status", cellular.getStatus());
   return addOrUpdate(cellular.getId(), Cellular.NAME, content);
 }
예제 #3
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;
 }