printfunctionfunction print(node: Node, dialect: Dialect, options?: PrintOptions): stringA node as text of a dialect.
The printer (commons lang-sql 0009-sql-print FR-001 to FR-004): any node of the tree as text of a dialect, quoting an identifier and a string as the dialect does (0007-sql-emit), parenthesizing an expression where its binding power asks for it, so that the text is read back by the parser of the same dialect as the same tree but for its ranges. A construct that the dialect does not read is written as the printer's dialect has it; nothing here throws.
print(parse("select a from t where x = 1 or y = 2 and z = 3", ansi).script.statements[0]!, ansi);
// 'SELECT a FROM t WHERE x = 1 OR y = 2 AND z = 3'Spec: 0009-sql-print FR-001, FR-003
printfunctionfunction print(node: Node, dialect: Dialect, options?: PrintOptions): stringA node as text of a dialect.
printScriptfunctionfunction printScript(parsed: Parsed, dialect: Dialect, options?: PrintOptions): stringA script as text of a dialect: its statements ended by ;, a statement that could not be read by its source text.
PrintOptionsinterfaceno test imports itinterface PrintOptionsWhat the printer may be asked.
| Member | Type | What it is |
|---|---|---|
pretty? | boolean | Each clause of a query on a line of its own, indented by two spaces for each level. |