toStatementInfo method

StatementInfo toStatementInfo()

Returns a StatementInfo reflecting the current state of this compiled statement buffer.

Implementation

StatementInfo toStatementInfo() {
  final watchedTables = <String>{};
  for (final watchedResultSet in this.watchedTables) {
    if (watchedResultSet is GeneratedView) {
      watchedTables.addAll(watchedResultSet.readsFrom);
    } else {
      watchedTables.add(watchedResultSet.entityName);
    }
  }

  return StatementInfo(
    buffer.toString(),
    variables: [
      for (final variable in variables) variable.resolveValue(dialect),
    ],
    needsResultSet: resultSetStructure != null,
    isReadOnly: isReadOnly,
    expectedWrites: possibleUpdates,
    watchedTables: watchedTables.toList(),
  );
}