27 #include "../common/StringUtils.h" 28 #include "../geometry/Envelope.h" 29 #include "../dataaccess/query/DataSetName.h" 30 #include "../dataaccess/query/Function.h" 31 #include "../dataaccess/query/Having.h" 32 #include "../dataaccess/query/Join.h" 33 #include "../dataaccess/query/JoinConditionOn.h" 34 #include "../dataaccess/query/LiteralEnvelope.h" 35 #include "../dataaccess/query/PropertyName.h" 36 #include "../dataaccess/query/Select.h" 37 #include "../dataaccess/query/Where.h" 38 #include "../dataaccess/Enums.h" 66 std::vector<std::string> values;
69 if(values.size() == 1)
72 m_sql +=
"\"" + values[values.size() - 1] +
"\"";
77 m_sql +=
"SELECT FID, ";
128 m_sql +=
" NATURAL ";
137 m_sql +=
" INNER JOIN ";
141 m_sql +=
" LEFT JOIN ";
145 m_sql +=
" RIGHT JOIN ";
149 m_sql +=
" FULL OUTER JOIN ";
153 m_sql +=
" CROSS JOIN ";
157 m_sql +=
" NATURAL JOIN ";
176 const std::string& fname = func.
getName();
197 m_sql =
"SELECT DISTINCT ";
199 for (std::size_t i = 0; i < visited.size(); ++i)
206 const std::string& att = propName->
getName();
211 size_t size =
m_sql.size();
const Distinct * getDistinct() const
It returns the Distinct modifier.
const std::string & getName() const
It returns the property name.
te::da::SQLDialect * dialect
const OrderBy * getOrderBy() const
It returns the list of expressions used to sort the output result.
A visitor for building an SQL statement using OGR dialect.
A class that models the name of a dataset used in a From clause.
te::gm::Envelope * m_bbox
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 class that models the name of any property of an object.
te::gm::Envelope * getMBR()
virtual Expression * clone() const =0
It creates a new copy of this expression.
It represents the SQL query dialect accepted by a given data source.
Expression * getCondition() const
It returns a pointer to a join condition.
JoinType getType() const
It returns the join type.
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object.
void visit(const te::da::DataSetName &visited)
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.
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
It tokenizes a given string with a delimiter of your own choice.
bool isNatural() const
It tells if the join is Natural.
An Envelope defines a 2D rectangular region.
virtual void visit(const Expression &visited)
std::string & m_sql
The buffer string where the query will be outputed.
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 Join clause combines two FromItems.
Expression * getExp() const
const std::string & getName() const
It returns the function name.
SQLVisitor(const te::da::SQLDialect &dialect, std::string &sql)
Default constructor.
A Select models a query to be used when retrieving data from a DataSource.
FromItem * getSecond() const
It returns the second item involved in the join.
Where * getWhere() const
It returns the filter condition.
JoinCondition * getCondition() const
It returns the join condition.
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.
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
std::size_t getNumArgs() const
It returns the number of arguments informed to the function.
void visitDistinct(const te::da::Distinct &visited)
te::gm::Envelope * getValue() const
It returns the associated envelope value.
FromItem * getFirst() const
It returns the first from item involved in the join.