execute method
Executes an SQL statement.
Returns different results based on the operation:
- INSERT: the last inserted row id
- UPDATE: the number of affected rows
- DELETE: the number of affected rows
- other: the result of the statement
tables is used by the reactive stream system to know which watched
queries to refresh after this operation.
Implementation
@override
Future<dynamic> execute(String sql,
{List<String>? tables,
List<Object?> params = const [],
String? dbName}) async {
try {
final response = await client.execute(SqlQueryRequest(
sql: sql,
params: convertParamsToParam(params),
dbName: dbName ?? defaultDBName,
tables: tables ?? [],
));
return dartFromValue(response.result);
} finally {
if (streams.isNotEmpty) {
await updateStreams(tables);
}
}
}