27 #include "../../common/StringUtils.h"
28 #include "../../common/Translator.h"
29 #include "../../datatype/AbstractData.h"
30 #include "../Exception.h"
75 if(visited.
getAlias().empty() ==
false)
88 const std::string& fname = visited.
getName();
93 throw Exception(
TE_TR(
"The informed function is not supported by this driver!"));
95 encoder->
toSQL(visited, m_sql, *
this);
106 m_sql +=
" NATURAL ";
115 m_sql +=
" INNER JOIN ";
119 m_sql +=
" LEFT JOIN ";
123 m_sql +=
" RIGHT JOIN ";
127 m_sql +=
" FULL OUTER JOIN ";
131 m_sql +=
" CROSS JOIN ";
135 m_sql +=
" NATURAL JOIN ";
168 for(
size_t i = 0; i < ncols; ++i)
174 visited[i]->
accept(*
this);
311 if(visited.
getAlias().empty() ==
false)
326 for(
size_t i = 0; i < visited.
getNumArgs(); ++i)
332 visited[i]->
accept(*
this);
346 m_sql +=
"DISTINCT ON(";
348 std::size_t ncols = visited.size();
350 for(std::size_t i = 0; i < ncols; ++i)
355 visited[i].accept(*
this);
364 std::size_t size = visited.size();
366 for(
size_t i = 0; i < size; ++i)
371 visited[i].getExpression()->accept(*
this);
373 if(visited[i].getAlias())
374 m_sql += *(visited[i].getAlias());
380 std::size_t size = visited.size();
384 for(std::size_t i = 0; i < size; ++i)
389 visited[i].accept(*
this);
395 m_sql +=
"GROUP BY ";
397 std::size_t ncols = visited.size();
399 for(std::size_t i = 0; i < ncols; ++i)
404 visited[i].getExpression()->accept(*
this);
410 std::size_t size = visited.size();
412 m_sql +=
"ORDER BY ";
414 for(std::size_t i = 0; i < size; ++i)
419 visited[i].getExpression()->accept(*
this);
const Distinct * getDistinct() const
It returns the Distinct modifier.
const std::string & getName() const
It returns the property name.
A class that models a Literal for a integer value.
boost::ptr_vector< GroupByItem > GroupBy
A class that can be used to model a GROUP BY clause.
const OrderBy * getOrderBy() const
It returns the list of expressions used to sort the output result.
An abstract class that models a source of data in a query.
A class that models a Function expression.
Select * getSelect() const
It returns the associated subselect.
virtual void visitDistinct(const Distinct &visited)
A class that models the name of a dataset used in a From clause.
A class that models the name of any property of an object.
const GroupBy * getGroupBy() const
It returns the list of expressions used to condense the result set.
boost::ptr_vector< Expression > Distinct
A class that models a Distinct clause on a query.
A base class for encoders of SQL function expressions.
A class that models the name of any property of an object.
A class that represents the IN operator.
A class that models a Literal Bool value.
A class that models the name of a dataset used in a From clause.
A class that models a Distinct clause on a query.
This class models a bool Literal value.
It represents the SQL query dialect accepted by a given data source.
Expression * getCondition() const
It returns a pointer to a join condition.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
virtual std::string toString() const =0
It returns the data value in a string notation.
JoinType getType() const
It returns the join type.
A class that models a literal for ByteArray values.
#define TE_TR(message)
It marks a string in order to get translated.
A visitor for building an SQL statement from a given Query hierarchy.
const From * getFrom() const
It returns the list of source information to be used by the query.
This is an abstract class that models a query expression.
A Join clause combines two FromItems.
A class that models a literal for Date and Time values.
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
PropertyName * getPropertyName() const
It returns the property name.
bool isNatural() const
It tells if the join is Natural.
A Having is a filter expression that can be applied to a query with a group by clause.
A class that models a literal for Date and Time values.
const std::string & getAlias() const
It returns the alias associated to the source item.
This class models a literal value.
virtual void visit(const Expression &visited)
A condition to be used in a Join clause.
A class that models a Literal for a integer value.
A class that models a literal for ByteArray values.
A condition to be used in a Join clause.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A class that models a Literal for a integer value.
This is an abstract class that models a query expression.
Expression * getExp() const
A class that models a Function expression.
const Fields * getFields() const
It returns the list of output expressions used to form the result set.
A class that can be used in a GROUP BY clause.
A Join clause combines two FromItems.
Expression * getExp() const
A class that models a literal for double values.
A Select models a query to be used when retrieving data from a data source.
std::size_t getNumFields() const
It returns the number of fields in this join condition.
const std::string & getName() const
It returns the function name.
A Select models a query to be used when retrieving data from a DataSource.
JoinConditionUsing class can be used to model a USING clause in a Join.
A class that can be used to model a GROUP BY clause.
A class that can be used to model a filter expression that can be applied to a query.
A class that models a Literal String value.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
FromItem * getSecond() const
It returns the second item involved in the join.
Where * getWhere() const
It returns the filter condition.
A class that models a literal for double values.
JoinCondition * getCondition() const
It returns the join condition.
JoinConditionUsing class can be used to model a USING clause in a Join.
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object.
const Having * getHaving() const
It returns the list of expressions used to eliminate group row that doesn't satisfy the condition...
A class that models a literal for Envelope values.
const std::string & getName() const
It returns the dataset name.
A Select can be used as a source of information in another query.
A class that represents the IN operator.
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
A Select can be used as a source of information in another query.
A class that models a literal for Geometry values.
te::dt::AbstractData * getValue() const
It returns the value associated to the literal.
A base class for encoders of SQL function expressions.
A Query is independent from the data source language/dialect.
std::size_t getNumArgs() const
It returns the number of arguments informed to the function.
virtual void toSQL(const Function &f, std::string &buff, SQLVisitor &v) const =0
It encodes the function to a SQL notation.
FromItem * getFirst() const
It returns the first from item involved in the join.
A class that models a literal for Geometry values.
This class models a literal value.
This class models a string Literal value.