mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
m::QueryGraph2SQL Struct Reference

Translates a query graph in SQL. More...

#include <QueryGraph2SQL.hpp>

Inheritance diagram for m::QueryGraph2SQL:
[legend]
Collaboration diagram for m::QueryGraph2SQL:
[legend]

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 QueryGraphgraph_
 
bool after_grouping_ = false
 the graph to translate
 

Detailed Description

Translates a query graph in SQL.

Definition at line 13 of file QueryGraph2SQL.hpp.

Constructor & Destructor Documentation

◆ QueryGraph2SQL() [1/3]

m::QueryGraph2SQL::QueryGraph2SQL ( std::ostream &  out)
inline

Definition at line 21 of file QueryGraph2SQL.hpp.

◆ QueryGraph2SQL() [2/3]

m::QueryGraph2SQL::QueryGraph2SQL ( std::ostream &  out,
const QueryGraph graph 
)
inlineprivate

Definition at line 23 of file QueryGraph2SQL.hpp.

◆ QueryGraph2SQL() [3/3]

m::QueryGraph2SQL::QueryGraph2SQL ( std::ostream &  out,
const QueryGraph graph,
bool  after_grouping 
)
inlineprivate

Definition at line 24 of file QueryGraph2SQL.hpp.

Member Function Documentation

◆ insert_projection()

void QueryGraph2SQL::insert_projection ( const ast::Expr e)
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().

◆ make_unique_alias()

ThreadSafePooledString QueryGraph2SQL::make_unique_alias ( )
staticprivate

Definition at line 133 of file QueryGraph2SQL.cpp.

References m::Catalog::Get(), id, and m::Catalog::pool().

Referenced by translate().

◆ operator()() [1/3]

void QueryGraph2SQL::operator() ( const cnf::Clause clause)
private

Definition at line 210 of file QueryGraph2SQL.cpp.

References out_.

◆ operator()() [2/3]

void QueryGraph2SQL::operator() ( const cnf::CNF cnf)
private

Definition at line 219 of file QueryGraph2SQL.cpp.

References out_.

◆ operator()() [3/3]

void m::QueryGraph2SQL::operator() ( const QueryGraph graph)
inline

Definition at line 30 of file QueryGraph2SQL.hpp.

References translate().

◆ references_group_by()

bool m::QueryGraph2SQL::references_group_by ( ast::Designator::target_type  )
private

Checks whether the given target references an expression contained in the group_by clause.

◆ translate()

void QueryGraph2SQL::translate ( const QueryGraph graph)

◆ translate_projection()

void QueryGraph2SQL::translate_projection ( std::pair< std::reference_wrapper< const ast::Expr >, ThreadSafePooledOptionalString p)
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().

Field Documentation

◆ after_grouping_

bool m::QueryGraph2SQL::after_grouping_ = false
private

the graph to translate

indicates whether a grouping is already performed

Definition at line 18 of file QueryGraph2SQL.hpp.

Referenced by translate().

◆ graph_

const QueryGraph* m::QueryGraph2SQL::graph_
private

Definition at line 17 of file QueryGraph2SQL.hpp.

Referenced by insert_projection(), and translate().

◆ out_

std::ostream& m::QueryGraph2SQL::out_
private

the output stream to write to

Definition at line 16 of file QueryGraph2SQL.hpp.

Referenced by insert_projection(), operator()(), translate(), and translate_projection().


The documentation for this struct was generated from the following files: