update method
Updates one or more rows in the specified table.
data: Column values to update.where: Conditions to match rows (e.g.,{'id': 1}).
Implementation
@override
Future<DbResult> update(
String table,
Map<String, dynamic> data, {
required Map<String, dynamic> where,
}) async {
final sets = data.keys.map((k) => '$k = ?').join(', ');
final cond = where.keys.map((k) => '$k = ?').join(' AND ');
// Use w_ prefix on where keys to avoid collision with data keys when
// updating a column that also appears in the WHERE clause.
final values = {
...data,
...{for (final e in where.entries) 'w_${e.key}': e.value},
};
return _run(_db, 'UPDATE $table SET $sets WHERE $cond;', values);
}