customUpdate method

Future<int> customUpdate(
  1. String query, {
  2. List<Variable<Object>> variables = const [],
  3. Set<TableInfo<Table, dynamic>>? updates,
  4. UpdateKind? updateKind,
})

Executes a custom delete or update statement and returns the amount of rows that have been changed. You can use the updates parameter so that drift knows which tables are affected by your query. All select streams that depend on a table specified there will then update their data. For more accurate results, you can also set the updateKind parameter to UpdateKind.delete or UpdateKind.update. This is optional, but can improve the accuracy of query updates, especially when using triggers.

Implementation

Future<int> customUpdate(
  String query, {
  List<Variable> variables = const [],
  Set<TableInfo>? updates,
  UpdateKind? updateKind,
}) async {
  return _customWrite(
    query,
    variables,
    updates,
    updateKind,
    (executor, sql, vars) {
      return executor.runUpdate(sql, vars);
    },
  );
}