![]() |
mutable
A Database System for Research and Fast Prototyping
|
Translates a query graph in SQL. More...
#include <QueryGraph2SQL.hpp>
Public Member Functions | |
QueryGraph2SQL (std::ostream &out) | |
void | translate (const QueryGraph &) |
Translates the given QueryGraph into SQL. | |
void | operator() (const QueryGraph &graph) |
Private Member Functions | |
QueryGraph2SQL (std::ostream &out, const QueryGraph *graph) | |
QueryGraph2SQL (std::ostream &out, const QueryGraph *graph, bool after_grouping) | |
void | insert_projection (const ast::Expr *) |
Inserts a projection for the given Expr which is computed by a grouping operator. | |
void | translate_projection (std::pair< std::reference_wrapper< const ast::Expr >, ThreadSafePooledOptionalString >) |
Translates a projection for the given pair of Expr and alias. | |
bool | references_group_by (ast::Designator::target_type) |
Checks whether the given target references an expression contained in the group_by clause. | |
M_AST_EXPR_LIST(DECLARE) void operator()(const cnf void | operator() (const cnf::Clause &) |
void | operator() (const cnf::CNF &) |
Static Private Member Functions | |
static ThreadSafePooledString | make_unique_alias () |
Private Attributes | |
std::ostream & | out_ |
the output stream to write to | |
const QueryGraph * | graph_ |
bool | after_grouping_ = false |
the graph to translate | |
Translates a query graph in SQL.
Definition at line 13 of file QueryGraph2SQL.hpp.
|
inline |
Definition at line 21 of file QueryGraph2SQL.hpp.
|
inlineprivate |
Definition at line 23 of file QueryGraph2SQL.hpp.
|
inlineprivate |
Definition at line 24 of file QueryGraph2SQL.hpp.
|
private |
Inserts a projection for the given Expr
which is computed by a grouping operator.
Adds an alias iff the expression has to be renamed, e.g. due to a multiple use of .
in mu*t*able which is not valid in SQL.
Definition at line 95 of file QueryGraph2SQL.cpp.
References graph_, out_, m::replace_all(), m::streq(), and m::to_string().
Referenced by translate_projection().
|
staticprivate |
Definition at line 133 of file QueryGraph2SQL.cpp.
References m::Catalog::Get(), id, and m::Catalog::pool().
Referenced by translate().
|
private |
Definition at line 210 of file QueryGraph2SQL.cpp.
References out_.
|
private |
Definition at line 219 of file QueryGraph2SQL.cpp.
References out_.
|
inline |
Definition at line 30 of file QueryGraph2SQL.hpp.
References translate().
|
private |
Checks whether the given target references an expression contained in the group_by clause.
void QueryGraph2SQL::translate | ( | const QueryGraph & | graph | ) |
Translates the given QueryGraph
into SQL.
Note that no semicolon is appended.
Definition at line 9 of file QueryGraph2SQL.cpp.
References after_grouping_, m::and, graph_, m::QueryGraph::group_by(), m::QueryGraph::joins(), m::QueryGraph::limit, M_insist, M_unreachable, make_unique_alias(), m::QueryGraph::order_by(), out_, m::QueryGraph::projections(), m::QueryGraph::sources(), translate(), and translate_projection().
Referenced by operator()(), and translate().
|
private |
Translates a projection for the given pair of Expr
and alias.
Adds an alias iff none is specified and the expression has to be renamed, e.g. due to a multiple use of .
in mu*t*able which is not valid in SQL.
Definition at line 117 of file QueryGraph2SQL.cpp.
References insert_projection(), out_, and m::replace_all().
Referenced by translate().
|
private |
the graph to translate
indicates whether a grouping is already performed
Definition at line 18 of file QueryGraph2SQL.hpp.
Referenced by translate().
|
private |
Definition at line 17 of file QueryGraph2SQL.hpp.
Referenced by insert_projection(), and translate().
|
private |
the output stream to write to
Definition at line 16 of file QueryGraph2SQL.hpp.
Referenced by insert_projection(), operator()(), translate(), and translate_projection().