27 #include "../dataaccess/query/Field.h" 28 #include "../dataaccess/query/Fields.h" 29 #include "../dataaccess/query/JoinConditionOn.h" 30 #include "../dataaccess/query/LiteralByteArray.h" 31 #include "../dataaccess/query/LiteralDateTime.h" 32 #include "../dataaccess/query/LiteralEnvelope.h" 33 #include "../dataaccess/query/LiteralGeom.h" 34 #include "../dataaccess/query/PropertyName.h" 35 #include "../dataaccess/query/ST_EnvelopeIntersects.h" 36 #include "../geometry/Envelope.h" 44 #include <boost/lexical_cast.hpp> 69 m_sql +=
" lower_x = " + boost::lexical_cast<std::string>(env->getLowerLeftX());
70 m_sql +=
" upper_x = " + boost::lexical_cast<std::string>(env->getUpperRightX());
71 m_sql +=
" lower_y = " + boost::lexical_cast<std::string>(env->getLowerLeftY());
72 m_sql +=
" upper_y = " + boost::lexical_cast<std::string>(env->getUpperRightY());
85 if(envIntersects == 0)
108 std::string lowerX =
"lower_x";
109 std::string upperX =
"upper_x";
110 std::string lowerY =
"lower_y";
111 std::string upperY =
"upper_y";
113 m_sql +=
"NOT("+ lowerX +
" > " + boost::lexical_cast<std::string>(e->
m_urx) +
" OR ";
114 m_sql += upperX +
" < " + boost::lexical_cast<std::string>(e->
m_llx) +
" OR ";
115 m_sql += lowerY +
" > " + boost::lexical_cast<std::string>(e->
m_ury) +
" OR ";
116 m_sql += upperY +
" < " + boost::lexical_cast<std::string>(e->
m_lly) +
")";
121 std::vector<std::string> values;
124 if(values.size() == 1)
127 m_sql += values[values.size() - 1];
149 std::size_t size = visited.size();
151 for (
size_t i = 0; i < size; ++i)
156 visited[i].getExpression()->accept(*
this);
158 if (visited[i].getAlias())
160 std::vector<std::string> values;
161 std::string alias = *(visited[i].getAlias());
166 for (std::string token : values)
const std::string & getName() const
It returns the property name.
Expression * getFirst() const
It returns the first function argument.
te::da::SQLDialect * dialect
A class that models the name of any property of an object.
Utility functions for ADO.
SQLVisitor(const te::da::SQLDialect &dialect, std::string &sql, _ConnectionPtr conn)
Default constructor.
It represents the SQL query dialect accepted by a given data source.
double m_urx
Upper right corner x-coordinate.
Expression * getCondition() const
It returns a pointer to a join condition.
A class that models a literal for Date and Time values.
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.
double m_llx
Lower left corner x-coordinate.
An operator that considers the intersection among approximations or envelopes of geometries.
An Envelope defines a 2D rectangular region.
virtual void visit(const Expression &visited)
A class that models a literal for ByteArray values.
std::string & m_sql
The buffer string where the query will be outputed.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A visitor for building an SQL statement using ADO dialect.
A class that models a Function expression.
void visit(const te::da::Function &visited)
const std::string & getName() const
It returns the function name.
A visitor for building an SQL statement using ADO dialect.
double m_lly
Lower left corner y-coordinate.
double m_ury
Upper right corner y-coordinate.
A class that models a literal for Envelope values.
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
Expression * getSecond() const
It returns the second function argument.
te::dt::AbstractData * getValue() const
It returns the value associated to the literal.
te::gm::Envelope * getValue() const
It returns the associated envelope value.
A class that models a literal for Geometry values.