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:
@@ -409,7 +409,11 @@ class Segment {
|
|||||||
|
|
||||||
void dbInsert() async {
|
void dbInsert() async {
|
||||||
Database database = DbHelper.db;
|
Database database = DbHelper.db;
|
||||||
id = await database.insert(tableName, toMap());
|
id = await database.insert(
|
||||||
|
tableName,
|
||||||
|
toMap(),
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbUpdate() async {
|
void dbUpdate() async {
|
||||||
@@ -532,7 +536,11 @@ class Station {
|
|||||||
|
|
||||||
void dbInsert() async {
|
void dbInsert() async {
|
||||||
Database database = DbHelper.db;
|
Database database = DbHelper.db;
|
||||||
database.insert(tableName, _toMap());
|
database.insert(
|
||||||
|
tableName,
|
||||||
|
_toMap(),
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _dbInsertStationLines() async {
|
void _dbInsertStationLines() async {
|
||||||
@@ -636,7 +644,11 @@ class Vehicle {
|
|||||||
|
|
||||||
void dbInsert() async {
|
void dbInsert() async {
|
||||||
Database database = DbHelper.db;
|
Database database = DbHelper.db;
|
||||||
database.insert(tableName, _toMap());
|
database.insert(
|
||||||
|
tableName,
|
||||||
|
_toMap(),
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbUpdate() async {
|
void dbUpdate() async {
|
||||||
@@ -740,7 +752,11 @@ class Line {
|
|||||||
|
|
||||||
void dbInsert() async {
|
void dbInsert() async {
|
||||||
Database database = DbHelper.db;
|
Database database = DbHelper.db;
|
||||||
database.insert(tableName, _toMap());
|
database.insert(
|
||||||
|
tableName,
|
||||||
|
_toMap(),
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbUpdate() async {
|
void dbUpdate() async {
|
||||||
@@ -802,7 +818,7 @@ class Departure {
|
|||||||
factory Departure.fromJson(Map<String, dynamic> json) {
|
factory Departure.fromJson(Map<String, dynamic> json) {
|
||||||
Vehicle vehicle = Vehicle.fromJson(json["Product"][0]);
|
Vehicle vehicle = Vehicle.fromJson(json["Product"][0]);
|
||||||
// try {
|
// try {
|
||||||
// vehicle.dbInsert();
|
vehicle.dbInsert();
|
||||||
// } catch (e) {
|
// } catch (e) {
|
||||||
// vehicle.dbUpdate();
|
// vehicle.dbUpdate();
|
||||||
// }
|
// }
|
||||||
@@ -812,7 +828,7 @@ class Departure {
|
|||||||
transportLines: [],
|
transportLines: [],
|
||||||
);
|
);
|
||||||
// try {
|
// try {
|
||||||
// station.dbInsert();
|
station.dbInsert();
|
||||||
// } catch (e) {
|
// } catch (e) {
|
||||||
// station.dbUpdate();
|
// station.dbUpdate();
|
||||||
// }
|
// }
|
||||||
@@ -907,7 +923,11 @@ class Departure {
|
|||||||
|
|
||||||
void dbInsert() async {
|
void dbInsert() async {
|
||||||
Database database = DbHelper.db;
|
Database database = DbHelper.db;
|
||||||
id = await database.insert(tableName, _toMap());
|
id = await database.insert(
|
||||||
|
tableName,
|
||||||
|
_toMap(),
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbUpdate() async {
|
void dbUpdate() async {
|
||||||
|
|||||||
Reference in New Issue
Block a user