run method

Future<int> run(
  1. MySQLConnection connection
)

Implementation

Future<int> run(MySQLConnection connection) async {
  //return connection.execute(compile());
  int affectedRows = 0;
  await connection.transactional((ctx) async {
    var sql = compile();
    var result = await ctx.execute(sql).catchError((e) {
      _log.severe('Failed to run query: [ $sql ]', e);
    });
    affectedRows = result.affectedRows.toInt();
  }).catchError((e) {
    _log.severe('Failed to run query in a transaction', e);
  });

  return affectedRows;
}