Public Access
feat(transport_helper): add conflictAlgorithm to db inserts
this way we can try to persist data at liberty without risking failure right now, redundant entries will be ignored and updates have to happen with update nothing calls dbUpdate yet
This commit is contained in:
1 parent
4b499d63a6
commit
32d8473086
1 file changed
+27
-7
@@ -409,7 +409,11 @@ class Segment {
|
||||
|
||||
void dbInsert() async {
|
||||
Database database = DbHelper.db;
|
||||
id = await database.insert(tableName, toMap());
|
||||
id = await database.insert(
|
||||
tableName,
|
||||
toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
);
|
||||
}
|
||||
|
||||
void dbUpdate() async {
|
||||
@@ -532,7 +536,11 @@ class Station {
|
||||
|
||||
void dbInsert() async {
|
||||
Database database = DbHelper.db;
|
||||
database.insert(tableName, _toMap());
|
||||
database.insert(
|
||||
tableName,
|
||||
_toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
);
|
||||
}
|
||||
|
||||
void _dbInsertStationLines() async {
|
||||
@@ -636,7 +644,11 @@ class Vehicle {
|
||||
|
||||
void dbInsert() async {
|
||||
Database database = DbHelper.db;
|
||||
database.insert(tableName, _toMap());
|
||||
database.insert(
|
||||
tableName,
|
||||
_toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
);
|
||||
}
|
||||
|
||||
void dbUpdate() async {
|
||||
@@ -740,7 +752,11 @@ class Line {
|
||||
|
||||
void dbInsert() async {
|
||||
Database database = DbHelper.db;
|
||||
database.insert(tableName, _toMap());
|
||||
database.insert(
|
||||
tableName,
|
||||
_toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
);
|
||||
}
|
||||
|
||||
void dbUpdate() async {
|
||||
@@ -802,7 +818,7 @@ class Departure {
|
||||
factory Departure.fromJson(Map<String, dynamic> json) {
|
||||
Vehicle vehicle = Vehicle.fromJson(json["Product"][0]);
|
||||
// try {
|
||||
// vehicle.dbInsert();
|
||||
vehicle.dbInsert();
|
||||
// } catch (e) {
|
||||
// vehicle.dbUpdate();
|
||||
// }
|
||||
@@ -812,7 +828,7 @@ class Departure {
|
||||
transportLines: [],
|
||||
);
|
||||
// try {
|
||||
// station.dbInsert();
|
||||
station.dbInsert();
|
||||
// } catch (e) {
|
||||
// station.dbUpdate();
|
||||
// }
|
||||
@@ -907,7 +923,11 @@ class Departure {
|
||||
|
||||
void dbInsert() async {
|
||||
Database database = DbHelper.db;
|
||||
id = await database.insert(tableName, _toMap());
|
||||
id = await database.insert(
|
||||
tableName,
|
||||
_toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
);
|
||||
}
|
||||
|
||||
void dbUpdate() async {
|
||||
|
||||
Reference in new issue
Block a user