exosql v0.2.67 ExoSQL.Parser View Source
Parsed an SQL statement into a ExoSQL.Query.
The Query then needs to be planned and executed.
It also resolves partial column and table names using data from the context and its schema functions.
Uses leex and yecc to perform a first phase parsing, and then convert an dprocess the structure using more context knowledge to return a proper Query struct.
Link to this section Summary
Functions
Parses an SQL statement and returns the parsed ExoSQL struct
Calculates the list of all FQcolumns
Resolves all known tables at this context. This helps to fully qualify tables
From the list of tables, and context, and an unknown column, return the FQN of the column
Given a table-like tuple, returns the real table names
Link to this section Functions
Parses an SQL statement and returns the parsed ExoSQL struct.
Calculates the list of all FQcolumns.
This simplifies later the gathering of which table has which column and so on, specially when aliases are taken into account
Resolves all known tables at this context. This helps to fully qualify tables.
TODO Could be more efficient accessing as little as possible the schemas, but maybe not possible.
From the list of tables, and context, and an unknown column, return the FQN of the column.
Given a table-like tuple, returns the real table names
The table-like can be a function, a lateral join, or a simple table. It resolves unknown parts, as for example {:table, {nil, “table”}}, will fill which db.
It returns the same form, but with more data, and calling again will result in the same result.