diff --git a/lib/transport_helper.dart b/lib/transport_helper.dart index 3ab258e..2694410 100644 --- a/lib/transport_helper.dart +++ b/lib/transport_helper.dart @@ -173,6 +173,8 @@ class Route { id = await database.update( "route", toMapRoute(), + where: "id = ?", + whereArgs: [id], conflictAlgorithm: ConflictAlgorithm.replace, ); } @@ -184,6 +186,8 @@ class Route { database.update( "routesegments", routeSegments[i], + where: "route = ? AND segmentoder = ?", + whereArgs: [id, i], ); } } @@ -313,7 +317,12 @@ class Segment { void dbUpdate() async { Database database = DbHelper.db; - id = await database.update(tableName, toMap()); + id = await database.update( + tableName, + toMap(), + where: "rowid =?", + whereArgs: [id], + ); } void dbDelete() { @@ -432,14 +441,19 @@ class Station { void dbUpdate() async { Database database = DbHelper.db; - database.update(tableName, toMap()); + database.update(tableName, toMap(), where: "id = ?", whereArgs: [id]); } void dbUpdateStationLines() async { Database database = DbHelper.db; var stationLines = toMapLines(); for (var i = 0; i < stationLines.length; i++) { - database.update("stationlines", stationLines[i]); + database.update( + "stationlines", + stationLines[i], + where: "stationid = ? AND lineid = ?", + whereArgs: [id, stationLines[i]["lineid"]], + ); } } @@ -517,7 +531,7 @@ class Vehicle { void dbUpdate() async { Database database = DbHelper.db; - database.update(tableName, toMap()); + database.update(tableName, toMap(), where: "id=?", whereArgs: [id]); } void dbDelete() async { @@ -621,7 +635,12 @@ class Line { void dbUpdate() async { Database database = DbHelper.db; - database.update(tableName, toMap()); + database.update( + tableName, + toMap(), + where: "lineid = ?", + whereArgs: [lineId], + ); } void dbDelete() async { @@ -732,7 +751,12 @@ class Departure { void dbUpdate() async { Database database = DbHelper.db; - id = await database.update(tableName, toMap()); + id = await database.update( + tableName, + toMap(), + where: "id = ?", + whereArgs: [id], + ); } void dbDelete() async {