insertEntry method
Insert new entry to this table.
Implementation
Future<bool> insertEntry(T entry, {bool isolatedConnection = false}) async {
try {
await entry.beforeSave(true);
int result = 0;
var con =
await _initializeConnection(isolatedConnection: isolatedConnection);
var map = <String, dynamic>{};
entry.creationTime.value = DateTime.now();
entry.modificationTime.value = DateTime.now();
_setEntryToMap(entry, map);
String sqlStatement = _insertSqlGenerator(map);
result = (await con.query(sqlStatement, map.values.toList())).insertId!;
entry.id.value = result;
await entry.afterSave(true);
_fireChangeListners(EntryChangeType.Insertion, entry);
return result > 0;
} catch (e) {
return false;
}
}