fixing wireframe issue
This commit is contained in:
@@ -21,7 +21,8 @@ class UniController {
|
||||
// entity['active'] = entity['active'] ? 1 : 0;
|
||||
|
||||
// Insert data
|
||||
var entityId = await db.insert(tableName, entity);
|
||||
// OLD: var entityId = await db.insert(tableName, entity);
|
||||
var entityId = await db.insert(tableName, entity, conflictAlgorithm: ConflictAlgorithm.replace); // overwrite same id instead of crash - by Azmat on 23-sep
|
||||
if (entityId != null && entityId > 0) {
|
||||
print('$tableName Id data is inserted. $tableName Id ID: $entityId');
|
||||
} else {
|
||||
@@ -40,10 +41,12 @@ class UniController {
|
||||
print('multiple entity is com is $entities');
|
||||
|
||||
for (var entity in entities) {
|
||||
insertEntity(entity, tableName);
|
||||
// OLD: insertEntity(entity, tableName);
|
||||
batch.insert(tableName, entity, conflictAlgorithm: ConflictAlgorithm.replace);
|
||||
}
|
||||
|
||||
await batch.commit();
|
||||
// OLD: await batch.commit();
|
||||
await batch.commit(); // real batch write with overwrite - by Azmat on 23-sep
|
||||
}
|
||||
|
||||
// update Entity
|
||||
@@ -81,6 +84,11 @@ class UniController {
|
||||
return rowsAffected;
|
||||
}
|
||||
|
||||
Future<int> deleteAll(String tableName) async {
|
||||
Database db = await conn.database;
|
||||
return await db.delete(tableName); // clear table for fresh server sync - by Azmat on 23-sep
|
||||
}
|
||||
|
||||
// get count
|
||||
Future<int> getDataCount(String tableNmae) async {
|
||||
Database db = await conn.database;
|
||||
|
||||
Reference in New Issue
Block a user