27 #include "../../common/StringUtils.h"
28 #include "../../common/Translator.h"
29 #include "../../datatype/AbstractData.h"
30 #include "../Exception.h"
73 if(visited.
getAlias().empty() ==
false)
86 const std::string& fname = visited.
getName();
91 throw Exception(
TR_DATAACCESS(
"The informed function is not supported by this driver!"));
93 encoder->
toSQL(visited, m_sql, *
this);
104 m_sql +=
" NATURAL ";
113 m_sql +=
" INNER JOIN ";
117 m_sql +=
" LEFT JOIN ";
121 m_sql +=
" RIGHT JOIN ";
125 m_sql +=
" FULL OUTER JOIN ";
129 m_sql +=
" CROSS JOIN ";
133 m_sql +=
" NATURAL JOIN ";
166 for(
size_t i = 0; i < ncols; ++i)
172 visited[i]->
accept(*
this);
300 if(visited.
getAlias().empty() ==
false)
315 for(
size_t i = 0; i < visited.
getNumArgs(); ++i)
321 visited[i]->
accept(*
this);
335 m_sql +=
"DISTINCT ON(";
337 std::size_t ncols = visited.size();
339 for(std::size_t i = 0; i < ncols; ++i)
344 visited[i].accept(*
this);
353 std::size_t size = visited.size();
355 for(
size_t i = 0; i < size; ++i)
360 visited[i].getExpression()->accept(*
this);
362 if(visited[i].getAlias())
363 m_sql += *(visited[i].getAlias());
369 std::size_t size = visited.size();
373 for(std::size_t i = 0; i < size; ++i)
378 visited[i].accept(*
this);
384 m_sql +=
"GROUP BY ";
386 std::size_t ncols = visited.size();
388 for(std::size_t i = 0; i < ncols; ++i)
393 visited[i].getExpression()->accept(*
this);
399 std::size_t size = visited.size();
401 m_sql +=
"ORDER BY ";
403 for(std::size_t i = 0; i < size; ++i)
408 visited[i].getExpression()->accept(*
this);
A class that models a Literal for a integer value.
A class that models the name of a dataset used in a From clause.
JoinConditionUsing class can be used to model a USING clause in a Join.
const Having * getHaving() const
It returns the list of expressions used to eliminate group row that doesn't satisfy the condition...
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
A class that models a literal for Date and Time values.
A condition to be used in a Join clause.
A Select models a query to be used when retrieving data from a data source.
virtual void toSQL(const Function &f, std::string &buff, SQLVisitor &v) const =0
It encodes the function to a SQL notation.
PropertyName * getPropertyName() const
It returns the property name.
A Select models a query to be used when retrieving data from a DataSource.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
A base class for encoders of SQL function expressions.
A class that models a Distinct clause on a query.
A visitor for building an SQL statement from a given Query hierarchy.
const std::string & getName() const
It returns the property name.
FromItem * getSecond() const
It returns the second item involved in the join.
virtual std::string toString() const =0
It returns the data value in a string notation.
A class that models a literal for double values.
This class models a string Literal value.
const std::string & getName() const
It returns the dataset name.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
A class that models the name of any property of an object.
A base class for encoders of SQL function expressions.
A class that models the name of any property of an object.
const From * getFrom() const
It returns the list of source information to be used by the query.
It represents the SQL query dialect accepted by a given data source.
A class that models a Literal String value.
A class that models a Literal for a integer value.
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
A class that can be used to model a GROUP BY clause.
A Select can be used as a source of information in another query.
A class that models a literal for Geometry values.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
std::size_t getNumArgs() const
It returns the number of arguments informed to the function.
const Distinct * getDistinct() const
It returns the Distinct modifier.
An abstract class that models a source of data in a query.
JoinCondition * getCondition() const
It returns the join condition.
This class models a literal value.
virtual void visit(const Expression &visited)
A Query is independent from the data source language/dialect.
A class that models a literal for ByteArray values.
const std::string & getAlias() const
It returns the alias associated to the source item.
virtual void visitDistinct(const Distinct &visited)
A class that can be used to model a filter expression that can be applied to a query.
A class that models a Literal for a integer value.
Expression * getCondition() const
It returns a pointer to a join condition.
A class that models a literal for ByteArray values.
JoinConditionUsing class can be used to model a USING clause in a Join.
A class that models a literal for Envelope values.
A Having is a filter expression that can be applied to a query with a group by clause.
A class that models a Function expression.
Expression * getExp() const
A class that models the name of a dataset used in a From clause.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
A class that can be used in a GROUP BY clause.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
boost::ptr_vector< Expression > Distinct
A class that models a Distinct clause on a query.
FromItem * getFirst() const
It returns the first from item involved in the join.
JoinType getType() const
It returns the join type.
A class that models a literal for Geometry values.
#define TR_DATAACCESS(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
A condition to be used in a Join clause.
Select * getSelect() const
It returns the associated subselect.
boost::ptr_vector< GroupByItem > GroupBy
A class that can be used to model a GROUP BY clause.
This class models a literal value.
const GroupBy * getGroupBy() const
It returns the list of expressions used to condense the result set.
const std::string & getName() const
It returns the function name.
Expression * getExp() const
This is an abstract class that models a query expression.
This is an abstract class that models a query expression.
const Fields * getFields() const
It returns the list of output expressions used to form the result set.
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object.
const OrderBy * getOrderBy() const
It returns the list of expressions used to sort the output result.
A Select can be used as a source of information in another query.
Where * getWhere() const
It returns the filter condition.
bool isNatural() const
It tells if the join is Natural.
A Join clause combines two FromItems.
A class that models a Function expression.
A Join clause combines two FromItems.
A class that models a literal for double values.
std::size_t getNumFields() const
It returns the number of fields in this join condition.
A class that models a literal for Date and Time values.
te::dt::AbstractData * getValue() const
It returns the value associated to the literal.
A class that represents the IN operator.
A class that represents the IN operator.