Constructor
new ConditionCompiler(escaper)
Initialize the compiler.
Parameters:
Name | Type | Description |
---|---|---|
escaper |
Escaper | An instance of an Escaper that matches the database type (e.g. MySQLEscaper for a MySQL database). |
Methods
compile(parseTree, params) → {string}
Compile the parse tree.
Parameters:
Name | Type | Description |
---|---|---|
parseTree |
Object | A parse tree object, as created by the ConditionParser.parse() method. |
params |
Object | An object containing key-value pairs that are used to replace parameters in the query. The compiler verifies that there is a replacement for every parameter, but does not perform the actual replacement. |
Returns:
The compiled condition as a SQL string.
- Type
- string
getColumns(parseTree)
Get all the columns referenced in the parse tree and return them as an
array. The columns will be distinct (that is, if the same column
appears multiple times in the same condition, it will exist in the
returned array only once).
Parameters:
Name | Type | Description |
---|---|---|
parseTree |
The parse tree, as created by a ConditionParser. |