toSql method

String toSql()

Obtains a textual representation for AST nodes.

Parsing the output of toSql will result in an equal AST. Since only the AST is used, the output will not contain comments. It's possible for the output to have more than just whitespace changes if there are multiple ways to represent an equivalent node (e.g. the no-op FOR EACH ROW on triggers).

Implementation

String toSql() {
  final builder = NodeSqlBuilder(null);
  builder.visit(this, null);
  return builder.buffer.toString();
}