|
@@ -460,7 +460,8 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
* @return a list of missing network records.
|
|
* @return a list of missing network records.
|
|
*/
|
|
*/
|
|
public synchronized ArrayList<NetworkRecord> getMissingNetworkRecords(ArrayList<String> otherBSSIDs) {
|
|
public synchronized ArrayList<NetworkRecord> getMissingNetworkRecords(ArrayList<String> otherBSSIDs) {
|
|
- String selectQuery = "SELECT * FROM " + NetworkEntry.TABLE_NAME + " N WHERE " + ""+NetworkEntry.COLUMN_NAME_BSSID + " NOT IN " + otherBSSIDs;
|
|
|
|
|
|
+ String prefix = " WHERE " + "N."+NetworkEntry.COLUMN_NAME_BSSID + " NOT IN ";
|
|
|
|
+ String selectQuery = "SELECT * FROM " + NetworkEntry.TABLE_NAME + " N " + this.arrayToSQLString(otherBSSIDs, prefix);
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
|
ArrayList<NetworkRecord> networkInformation = new ArrayList<NetworkRecord>();
|
|
ArrayList<NetworkRecord> networkInformation = new ArrayList<NetworkRecord>();
|
|
@@ -476,6 +477,27 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
return networkInformation;
|
|
return networkInformation;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private String arrayToSQLString(ArrayList<String> a, String prefix)
|
|
|
|
+ {
|
|
|
|
+ String sql = "";
|
|
|
|
+
|
|
|
|
+ if (a.size() !=0){
|
|
|
|
+ sql = sql + prefix;
|
|
|
|
+ sql = sql + " ( ";
|
|
|
|
+
|
|
|
|
+ int i = 0;
|
|
|
|
+ for (String s : a){
|
|
|
|
+ i++;
|
|
|
|
+ sql = sql + "'" +s + "'";
|
|
|
|
+ if (i != a.size()){
|
|
|
|
+ sql = sql + ",";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ sql = sql + " ) ";
|
|
|
|
+ }
|
|
|
|
+ return sql;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Determines the number of different attacks in the database.
|
|
* Determines the number of different attacks in the database.
|
|
*
|
|
*
|
|
@@ -1816,7 +1838,8 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
*/
|
|
*/
|
|
public ArrayList<String> getMissingDeviceIds(ArrayList<String> devices){
|
|
public ArrayList<String> getMissingDeviceIds(ArrayList<String> devices){
|
|
ArrayList<String> ids = new ArrayList<String>();
|
|
ArrayList<String> ids = new ArrayList<String>();
|
|
- String selectQuery = "SELECT "+ SyncDeviceEntry.COLUMN_NAME_DEVICE_ID +" FROM " + SyncDeviceEntry.TABLE_NAME + " D WHERE " + SyncDeviceEntry.COLUMN_NAME_DEVICE_ID + " NOT IN " + devices;
|
|
|
|
|
|
+ String prefix = " D WHERE " + SyncDeviceEntry.COLUMN_NAME_DEVICE_ID + " NOT IN ";
|
|
|
|
+ String selectQuery = "SELECT "+ SyncDeviceEntry.COLUMN_NAME_DEVICE_ID +" FROM " + SyncDeviceEntry.TABLE_NAME + this.arrayToSQLString(devices,prefix);
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
|
Cursor cursor = db.rawQuery(selectQuery, null);
|
|
|
|
|