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 {
|
||||
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