|
@@ -1307,11 +1307,14 @@ public class HostageDBOpenHelper extends SQLiteOpenHelper {
|
|
|
*/
|
|
|
public synchronized void deleteAttacksByFilter(LogFilter filter){
|
|
|
String selectQuery = this.selectionQueryFromFilter(filter, "" + AttackEntry.COLUMN_NAME_ATTACK_ID);
|
|
|
- String deleteQuery = selectQuery.replace("SELECT ","DELETE FROM " +PacketEntry.TABLE_NAME + " NATURAL JOIN " + AttackEntry.TABLE_NAME + "WHERE "+ AttackEntry.COLUMN_NAME_ATTACK_ID+" in ( ");
|
|
|
- deleteQuery = deleteQuery + " )";
|
|
|
+ String deletePacketQuery = "DELETE FROM " +PacketEntry.TABLE_NAME + " WHERE "+ PacketEntry.TABLE_NAME + "."+ PacketEntry.COLUMN_NAME_ATTACK_ID+" in ( ";
|
|
|
+ deletePacketQuery = deletePacketQuery + selectQuery + " )";
|
|
|
+ String deleteAttacksQuery = "DELETE FROM " +AttackEntry.TABLE_NAME + " WHERE "+ AttackEntry.TABLE_NAME + "."+ AttackEntry.COLUMN_NAME_ATTACK_ID+" in ( ";
|
|
|
+ deleteAttacksQuery =deleteAttacksQuery + selectQuery + " )";
|
|
|
|
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
|
- db.execSQL(deleteQuery);
|
|
|
+ db.execSQL(deletePacketQuery);
|
|
|
+ db.execSQL(deleteAttacksQuery);
|
|
|
db.close();
|
|
|
}
|
|
|
|