27 #include "../../../Version.h" 28 #include "../../../common/BoostUtils.h" 29 #include "../../../core/filesystem/FileSystem.h" 30 #include "../../../core/uri/Utils.h" 31 #include "../../../core/utils/Platform.h" 32 #include "../../../datatype/AbstractData.h" 33 #include "../../../datatype/Enums.h" 34 #include "../../../datatype/serialization/xml/Serializer.h" 35 #include "../../../datatype/StringProperty.h" 36 #include "../../../datatype/Utils.h" 37 #include "../../../geometry/Geometry.h" 38 #include "../../../geometry/WKTReader.h" 39 #include "../../../xml/AbstractWriter.h" 40 #include "../../../xml/AbstractWriterFactory.h" 41 #include "../../../xml/Reader.h" 42 #include "../../../xml/ReaderFactory.h" 43 #include "../../dataset/DataSetType.h" 44 #include "../../datasource/DataSourceCapabilities.h" 45 #include "../../datasource/DataSourceCatalog.h" 46 #include "../../datasource/DataSourceInfo.h" 47 #include "../../datasource/DataSourceInfoManager.h" 48 #include "../../query/BinaryFunction.h" 49 #include "../../query/BinaryOpEncoder.h" 50 #include "../../query/DataSetName.h" 51 #include "../../query/Distinct.h" 52 #include "../../query/Expression.h" 53 #include "../../query/Field.h" 54 #include "../../query/FromItem.h" 55 #include "../../query/Function.h" 56 #include "../../query/FunctionEncoder.h" 57 #include "../../query/GroupByItem.h" 58 #include "../../query/Having.h" 59 #include "../../query/Join.h" 60 #include "../../query/JoinConditionOn.h" 61 #include "../../query/JoinConditionUsing.h" 62 #include "../../query/Literal.h" 63 #include "../../query/LiteralDouble.h" 64 #include "../../query/LiteralGeom.h" 65 #include "../../query/LiteralInt16.h" 66 #include "../../query/LiteralInt32.h" 67 #include "../../query/LiteralInt64.h" 68 #include "../../query/LiteralString.h" 69 #include "../../query/OrderByItem.h" 70 #include "../../query/PropertyName.h" 71 #include "../../query/Select.h" 72 #include "../../query/SQLDialect.h" 73 #include "../../query/SQLFunctionEncoder.h" 74 #include "../../query/TemplateEncoder.h" 75 #include "../../query/UnaryOpEncoder.h" 76 #include "../../query/Where.h" 77 #include "../../Exception.h" 86 #include <boost/algorithm/string/case_conv.hpp> 87 #include <boost/format.hpp> 88 #include <boost/lexical_cast.hpp> 89 #include <boost/algorithm/string/replace.hpp> 90 #include <boost/filesystem.hpp> 98 xmlReader->setValidationScheme(
false);
99 xmlReader->setDoSchema(
false);
100 xmlReader->read(datasourcesFileName);
102 if(!xmlReader->next())
103 throw te::da::Exception((boost::format(
TE_TR(
"Could not read data source information in file: %1%.")) % datasourcesFileName).str());
106 throw te::da::Exception((boost::format(
TE_TR(
"Error reading the document %1%, the start element wasn't found.")) % datasourcesFileName).str());
108 if(xmlReader->getElementLocalName() !=
"DataSourceList")
109 throw te::da::Exception((boost::format(
TE_TR(
"The first tag in the document %1% is not 'DataSourceList'.")) % datasourcesFileName).str());
111 if(!xmlReader->next())
115 (xmlReader->getElementLocalName() ==
"DataSource"))
128 ds->setId(reader.
getAttr(
"id"));
129 ds->setType(reader.
getAttr(
"type"));
130 ds->setAccessDriver(reader.
getAttr(
"access_driver"));
195 boost::replace_all(schema_loc,
" ",
"%20");
197 schema_loc =
"file:///" + schema_loc;
205 writer.
writeAttribute(
"xmlns:xsd",
"http://www.w3.org/2001/XMLSchema-instance");
206 writer.
writeAttribute(
"xmlns:te_common",
"http://www.terralib.org/schemas/common");
207 writer.
writeAttribute(
"xmlns",
"http://www.terralib.org/schemas/dataaccess");
208 writer.
writeAttribute(
"xsd:schemaLocation",
"http://www.terralib.org/schemas/dataaccess " + schema_loc);
216 for(it=itBegin; it!=itEnd; ++it)
222 writer.
writeAttribute(
"access_driver", it->second->getAccessDriver());
229 writer.
writeValue(it->second->getDescription());
277 return catalog.release();
284 Save(catalog, *w.get());
293 writer.
writeAttribute(
"xmlns:xlink",
"http://www.w3.org/1999/xlink");
294 writer.
writeAttribute(
"xmlns:xsd",
"http://www.w3.org/2001/XMLSchema-instance");
295 writer.
writeAttribute(
"xmlns",
"http://www.terralib.org/schemas/da");
296 writer.
writeAttribute(
"xsd:schemaLocation",
"http://www.terralib.org/schemas/da C:/Users/gribeiro/Documents/terralib5/trunk/myschemas/terralib/da/catalog.xsd");
304 for(std::size_t i = 0; i < ndatasets; ++i)
318 std::string name = reader.
getAttr(
"name");
319 std::string title = reader.
getAttr(
"title");
330 std::unique_ptr<te::dt::Property>
p(ReadProperty(reader));
331 dt->add(p.release());
348 const std::size_t nprops = dt->
size();
350 for(std::size_t i = 0; i < nprops; ++i)
358 if(accessPolicy ==
"NO_ACCESS")
360 else if (accessPolicy ==
"R_ACCESS")
362 else if(accessPolicy ==
"W_ACCESS")
364 else if(accessPolicy ==
"RW_ACCESS")
374 xmlReader->read(dialectFileName);
376 if(!xmlReader->next())
377 throw te::da::Exception((boost::format(
TE_TR(
"Could not read DataSourceCapabilities information in file: %1%.")) % dialectFileName).str());
380 throw te::da::Exception((boost::format(
TE_TR(
"Error reading the document %1%, the start element wasn't found.")) % dialectFileName).str());
382 if(xmlReader->getElementLocalName() !=
"DataSourceCapabilities")
383 throw te::da::Exception((boost::format(
TE_TR(
"The first tag in the document %1% is not 'DataSourceCapabilities'.")) % dialectFileName).str());
387 assert(xmlReader->getElementLocalName() ==
"DataTypeCapabilities");
391 while(xmlReader->next() &&
393 (xmlReader->getElementLocalName() ==
"DataType"))
410 assert(xmlReader->getElementLocalName() ==
"QueryCapabilities");
416 assert(xmlReader->getElementLocalName() ==
"SQLDialect");
426 assert(xmlReader->getElementLocalName() ==
"SpatialSQLDialect");
429 qc.setSupportSpatialSQLDialect(xmlReader->getElementValueAsBoolean());
436 assert(xmlReader->getElementLocalName() ==
"Insert");
440 qc.setSupportInsert(xmlReader->getElementValueAsBoolean());
447 assert(xmlReader->getElementLocalName() ==
"Update");
451 qc.setSupportUpdate(xmlReader->getElementValueAsBoolean());
458 assert(xmlReader->getElementLocalName() ==
"Delete");
462 qc.setSupportDelete(xmlReader->getElementValueAsBoolean());
469 assert(xmlReader->getElementLocalName() ==
"Create");
473 qc.setSupportCreate(xmlReader->getElementValueAsBoolean());
480 assert(xmlReader->getElementLocalName() ==
"Drop");
484 qc.setSupportDrop(xmlReader->getElementValueAsBoolean());
491 assert(xmlReader->getElementLocalName() ==
"Alter");
495 qc.setSupportAlter(xmlReader->getElementValueAsBoolean());
502 assert(xmlReader->getElementLocalName() ==
"Select");
506 qc.setSupportSelect(xmlReader->getElementValueAsBoolean());
513 assert(xmlReader->getElementLocalName() ==
"SelectInto");
517 qc.setSupportSelectInto(xmlReader->getElementValueAsBoolean());
526 assert(xmlReader->getElementLocalName() ==
"SpatialTopologicOperators");
528 while(xmlReader->next() &&
530 (xmlReader->getElementLocalName() ==
"Function"))
534 std::string fname = xmlReader->getAttr(
"name");
536 qc.addSpatialTopologicOperator(fname);
541 std::string encoderType = xmlReader->getElementLocalName();
543 if(encoderType ==
"FunctionEncoder")
545 std::string alias = xmlReader->getAttr(0);
548 else if(encoderType ==
"BinaryOpEncoder")
550 std::string alias = xmlReader->getAttr(0);
553 else if(encoderType ==
"UnaryOpEncoder")
555 std::string alias = xmlReader->getAttr(0);
558 else if(encoderType ==
"TemplateEncoder")
560 std::string alias = xmlReader->getAttr(0);
561 std::string temp = xmlReader->getAttr(1);
566 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
569 dialect.
insert(fname, sfe);
582 assert(xmlReader->getElementLocalName() ==
"SpatialMetricOperators");
584 while(xmlReader->next() &&
586 (xmlReader->getElementLocalName() ==
"Function"))
590 std::string fname = xmlReader->getAttr(
"name");
592 qc.addSpatialMetricOperator(fname);
597 std::string encoderType = xmlReader->getElementLocalName();
599 if(encoderType ==
"FunctionEncoder")
601 std::string alias = xmlReader->getAttr(0);
604 else if(encoderType ==
"BinaryOpEncoder")
606 std::string alias = xmlReader->getAttr(0);
609 else if(encoderType ==
"UnaryOpEncoder")
611 std::string alias = xmlReader->getAttr(0);
614 else if(encoderType ==
"TemplateEncoder")
616 std::string alias = xmlReader->getAttr(0);
617 std::string temp = xmlReader->getAttr(1);
622 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
625 dialect.
insert(fname, sfe);
638 assert(xmlReader->getElementLocalName() ==
"SpatialNewGeomOperators");
640 while(xmlReader->next() &&
642 (xmlReader->getElementLocalName() ==
"Function"))
646 std::string fname = xmlReader->getAttr(
"name");
648 qc.addSpatialNewGeomOperator(fname);
653 std::string encoderType = xmlReader->getElementLocalName();
655 if(encoderType ==
"FunctionEncoder")
657 std::string alias = xmlReader->getAttr(0);
660 else if(encoderType ==
"BinaryOpEncoder")
662 std::string alias = xmlReader->getAttr(0);
665 else if(encoderType ==
"UnaryOpEncoder")
667 std::string alias = xmlReader->getAttr(0);
670 else if(encoderType ==
"TemplateEncoder")
672 std::string alias = xmlReader->getAttr(0);
673 std::string temp = xmlReader->getAttr(1);
678 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
681 dialect.
insert(fname, sfe);
696 assert(xmlReader->getElementLocalName() ==
"SpatialOperators");
698 while(xmlReader->next() &&
700 (xmlReader->getElementLocalName() ==
"Function"))
704 std::string fname = xmlReader->getAttr(
"name");
706 qc.addSpatialOperator(fname);
711 std::string encoderType = xmlReader->getElementLocalName();
713 if(encoderType ==
"FunctionEncoder")
715 std::string alias = xmlReader->getAttr(0);
718 else if(encoderType ==
"BinaryOpEncoder")
720 std::string alias = xmlReader->getAttr(0);
723 else if(encoderType ==
"UnaryOpEncoder")
725 std::string alias = xmlReader->getAttr(0);
728 else if(encoderType ==
"TemplateEncoder")
730 std::string alias = xmlReader->getAttr(0);
731 std::string temp = xmlReader->getAttr(1);
736 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
739 dialect.
insert(fname, sfe);
752 assert(xmlReader->getElementLocalName() ==
"LogicalOperators");
754 while(xmlReader->next() &&
756 (xmlReader->getElementLocalName() ==
"Function"))
760 std::string fname = xmlReader->getAttr(
"name");
762 qc.addLogicalOperator(fname);
767 std::string encoderType = xmlReader->getElementLocalName();
769 if(encoderType ==
"FunctionEncoder")
771 std::string alias = xmlReader->getAttr(0);
774 else if(encoderType ==
"BinaryOpEncoder")
776 std::string alias = xmlReader->getAttr(0);
779 else if(encoderType ==
"UnaryOpEncoder")
781 std::string alias = xmlReader->getAttr(0);
784 else if(encoderType ==
"TemplateEncoder")
786 std::string alias = xmlReader->getAttr(0);
787 std::string temp = xmlReader->getAttr(1);
792 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
795 dialect.
insert(fname, sfe);
808 assert(xmlReader->getElementLocalName() ==
"ComparsionOperators");
810 while(xmlReader->next() &&
812 (xmlReader->getElementLocalName() ==
"Function"))
816 std::string fname = xmlReader->getAttr(
"name");
818 qc.addComparsionOperator(fname);
823 std::string encoderType = xmlReader->getElementLocalName();
825 if(encoderType ==
"FunctionEncoder")
827 std::string alias = xmlReader->getAttr(0);
830 else if(encoderType ==
"BinaryOpEncoder")
832 std::string alias = xmlReader->getAttr(0);
835 else if(encoderType ==
"UnaryOpEncoder")
837 std::string alias = xmlReader->getAttr(0);
840 else if(encoderType ==
"TemplateEncoder")
842 std::string alias = xmlReader->getAttr(0);
843 std::string temp = xmlReader->getAttr(1);
848 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
851 dialect.
insert(fname, sfe);
864 assert(xmlReader->getElementLocalName() ==
"ArithmeticOperators");
866 while(xmlReader->next() &&
868 (xmlReader->getElementLocalName() ==
"Function"))
872 std::string fname = xmlReader->getAttr(
"name");
874 qc.addArithmeticOperator(fname);
879 std::string encoderType = xmlReader->getElementLocalName();
881 if(encoderType ==
"FunctionEncoder")
883 std::string alias = xmlReader->getAttr(0);
886 else if(encoderType ==
"BinaryOpEncoder")
888 std::string alias = xmlReader->getAttr(0);
891 else if(encoderType ==
"UnaryOpEncoder")
893 std::string alias = xmlReader->getAttr(0);
896 else if(encoderType ==
"TemplateEncoder")
898 std::string alias = xmlReader->getAttr(0);
899 std::string temp = xmlReader->getAttr(1);
904 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
907 dialect.
insert(fname, sfe);
920 assert(xmlReader->getElementLocalName() ==
"Functions");
922 while(xmlReader->next() &&
924 (xmlReader->getElementLocalName() ==
"Function"))
928 std::string fname = xmlReader->getAttr(
"name");
930 qc.addFunction(fname);
935 std::string encoderType = xmlReader->getElementLocalName();
937 if(encoderType ==
"FunctionEncoder")
939 std::string alias = xmlReader->getAttr(0);
942 else if(encoderType ==
"BinaryOpEncoder")
944 std::string alias = xmlReader->getAttr(0);
947 else if(encoderType ==
"UnaryOpEncoder")
949 std::string alias = xmlReader->getAttr(0);
952 else if(encoderType ==
"TemplateEncoder")
954 std::string alias = xmlReader->getAttr(0);
955 std::string temp = xmlReader->getAttr(1);
960 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
963 dialect.
insert(fname, sfe);
976 assert(xmlReader->getElementLocalName() ==
"GeomOperands");
978 while(xmlReader->next() &&
980 (xmlReader->getElementLocalName() ==
"GeomType"))
985 std::string geom = boost::to_upper_copy(xmlReader->getElementValue());
1004 assert(xmlReader->getElementLocalName() ==
"DataSetTypeCapabilities");
1010 assert(xmlReader->getElementLocalName() ==
"SupportPrimaryKey");
1022 assert(xmlReader->getElementLocalName() ==
"SupportUniqueKey");
1027 dstc.setSupportUniqueKey(xmlReader->getElementValueAsBoolean());
1034 assert(xmlReader->getElementLocalName() ==
"SupportForeignKey");
1039 dstc.setSupportForeingKey(xmlReader->getElementValueAsBoolean());
1046 assert(xmlReader->getElementLocalName() ==
"SupportSequence");
1051 dstc.setSupportSequence(xmlReader->getElementValueAsBoolean());
1058 assert(xmlReader->getElementLocalName() ==
"SupportCheckConstraints");
1063 dstc.setSupportCheckConstraints(xmlReader->getElementValueAsBoolean());
1070 assert(xmlReader->getElementLocalName() ==
"SupportIndex");
1075 dstc.setSupportIndex(xmlReader->getElementValueAsBoolean());
1082 assert(xmlReader->getElementLocalName() ==
"SupportRTreeIndex");
1087 dstc.setSupportRTreeIndex(xmlReader->getElementValueAsBoolean());
1094 assert(xmlReader->getElementLocalName() ==
"SupportBTreeIndex");
1099 dstc.setSupportBTreeIndex(xmlReader->getElementValueAsBoolean());
1106 assert(xmlReader->getElementLocalName() ==
"SupportHashIndex");
1111 dstc.setSupportHashIndex(xmlReader->getElementValueAsBoolean());
1118 assert(xmlReader->getElementLocalName() ==
"SupportQuadTreeIndex");
1123 dstc.setSupportQuadTreeIndex(xmlReader->getElementValueAsBoolean());
1135 assert(xmlReader->getElementLocalName() ==
"DataSetCapabilities");
1141 assert(xmlReader->getElementLocalName() ==
"Bidirectional");
1153 assert(xmlReader->getElementLocalName() ==
"Random");
1158 dsetc.setSupportRandomTraversing(xmlReader->getElementValueAsBoolean());
1165 assert(xmlReader->getElementLocalName() ==
"Indexed");
1170 dsetc.setSupportIndexedTraversing(xmlReader->getElementValueAsBoolean());
1177 assert(xmlReader->getElementLocalName() ==
"EfficientMovePrevious");
1182 dsetc.setSupportEfficientMovePrevious(xmlReader->getElementValueAsBoolean());
1189 assert(xmlReader->getElementLocalName() ==
"EfficientMoveBeforeFirst");
1194 dsetc.setSupportEfficientMoveBeforeFirst(xmlReader->getElementValueAsBoolean());
1201 assert(xmlReader->getElementLocalName() ==
"EfficientMoveLast");
1206 dsetc.setSupportEfficientMoveLast(xmlReader->getElementValueAsBoolean());
1213 assert(xmlReader->getElementLocalName() ==
"EfficientMoveAfterLast");
1218 dsetc.setSupportEfficientMoveAfterLast(xmlReader->getElementValueAsBoolean());
1225 assert(xmlReader->getElementLocalName() ==
"EfficientMove");
1230 dsetc.setSupportEfficientMove(xmlReader->getElementValueAsBoolean());
1237 assert(xmlReader->getElementLocalName() ==
"EfficientSize");
1242 dsetc.setSupportEfficientDataSetSize(xmlReader->getElementValueAsBoolean());
1249 assert(xmlReader->getElementLocalName() ==
"IsConnected");
1254 dsetc.setAsConnected(xmlReader->getElementValueAsBoolean());
1266 assert(xmlReader->getElementLocalName() ==
"SpecificCapabilities");
1268 while(xmlReader->next() &&
1270 (xmlReader->getElementLocalName() ==
"Parameter"))
1274 assert(xmlReader->getElementLocalName() ==
"Name");
1279 std::string paramName = xmlReader->getElementValue();
1286 assert(xmlReader->getElementLocalName() ==
"Value");
1291 std::string paramValue = xmlReader->getElementValue();
1306 assert(xmlReader->getElementLocalName() ==
"AccessPolicyName");
1318 assert(xmlReader->getElementLocalName() ==
"SupportTransactions");
1330 assert(xmlReader->getElementLocalName() ==
"SupportDataSetPesistenceAPI");
1342 assert(xmlReader->getElementLocalName() ==
"SupportDataSetTypePesistenceAPI");
1354 assert(xmlReader->getElementLocalName() ==
"SupportPreparedQueryAPI");
1366 assert(xmlReader->getElementLocalName() ==
"SupportBatchExecutorAPI");
1385 xmlReader->read(dialectFileName);
1387 if(!xmlReader->next())
1388 throw te::da::Exception((boost::format(
TE_TR(
"Could not read query dialect information in file: %1%.")) % dialectFileName).str());
1391 throw te::da::Exception((boost::format(
TE_TR(
"Error reading the document %1%, the start element wasn't found.")) % dialectFileName).str());
1393 if(xmlReader->getElementLocalName() !=
"QueryDialect")
1394 throw te::da::Exception((boost::format(
TE_TR(
"The first tag in the document %1% is not 'QueryDialect'.")) % dialectFileName).str());
1398 assert(xmlReader->getElementLocalName() ==
"DriverName");
1407 assert(xmlReader->getElementLocalName() ==
"Functions");
1411 while(xmlReader->next() &&
1413 (xmlReader->getElementLocalName() ==
"Function"))
1415 std::string fname = xmlReader->getAttr(0);
1420 std::string encoderType = xmlReader->getElementLocalName();
1424 if(encoderType ==
"FunctionEncoder")
1426 std::string alias = xmlReader->getAttr(0);
1429 else if(encoderType ==
"BinaryOpEncoder")
1431 std::string alias = xmlReader->getAttr(0);
1434 else if(encoderType ==
"UnaryOpEncoder")
1436 std::string alias = xmlReader->getAttr(0);
1441 throw te::da::Exception(
TE_TR(
"Unsupported encoder type!"));
1447 mydialect->insert(fname, sfe);
1455 return mydialect.release();
1484 dist->push_back(exp);
1513 fields->push_back(f);
1519 fields->push_back(f);
1524 fields->push_back(f);
1591 else if (type ==
"INNER_JOIN")
1593 else if (type ==
"LEFT_JOIN")
1595 else if (type ==
"RIGHT_JOIN")
1597 else if (type ==
"FULL_OUTER_JOIN")
1599 else if ( type ==
"CROSS_JOIN")
1636 from->push_back(join);
1719 std::size_t countAux = 0;
1787 groupBy->push_back(groupByItem);
1887 throw te::da::Exception(
TE_TR(
"Data Type Undefined!"));
1938 orderBy->push_back(orderByItem);
1990 select->setFields(fields);
1996 select->setFrom(from);
2002 select->setWhere(wh);
2008 select->setGroupBy(gBy);
2014 select->setHaving(having);
2020 select->setOrderBy(oBy);
2026 select->setDistinct(distinct);
2033 select->setLimit(boost::lexical_cast<std::size_t>(reader.
getElementValue()));
2043 select->setOffset(boost::lexical_cast<std::size_t>(reader.
getElementValue()));
2091 for(std::size_t i = 0; i < distinct->size(); ++i)
2105 std::unique_ptr<te::da::Expression> exp(expression->
clone());
2113 Save(pName, writer);
2119 throw te::da::Exception(
TE_TR(
"Error: Expression Type Undefined!"));
2147 for(std::size_t i = 0; i < fields->size(); ++i)
2151 Save(&item, writer);
2161 for(std::size_t i = 0; i < from->size(); ++i)
2165 Save(&item, writer);
2202 std::string joinType;
2209 joinType =
"INNER_JOIN";
2212 joinType =
"LEFT_JOIN";
2215 joinType =
"RIGHT_JOIN";
2218 joinType =
"FULL_OUTER_JOIN";
2221 joinType =
"CROSS_JOIN";
2224 joinType =
"NATURAL_JOIN";
2246 for(std::size_t i = 0; i < joinUsing->
getNumFields(); ++i)
2265 std::string funcName = func->
getName();
2269 for(std::size_t i = 0; i < func->
getNumArgs(); i++)
2279 assert(groupByItem);
2291 for(std::size_t i = 0; i < groupBy->size(); ++i)
2295 Save(&item, writer);
2327 assert(orderByItem);
2344 for(std::size_t i = 0; i < orderBy->size(); ++i)
2348 Save(&item, writer);
2356 assert(propertyName);
2368 Save(fields, writer);
2380 Save(groupBy, writer);
2384 Save(having, writer);
2388 Save(orderBy, writer);
2392 Save(distinct, writer);
A class that can be used to model a filter expression that can be applied to a query.
Expression * getArg(std::size_t i) const
It returns the i-th function argument.
const Distinct * getDistinct() const
It returns the Distinct modifier.
Property * getProperty(std::size_t i) const
It returns the i-th property.
std::map< std::string, DataSourceInfoPtr >::iterator iterator
TEXSDEXPORT void Save(All *all, te::xml::AbstractWriter &writer)
const std::string & getName() const
It returns the property name.
boost::ptr_vector< GroupByItem > GroupBy
A class that can be used to model a GROUP BY clause.
te::da::SQLDialect * dialect
A class that informs what kind of constraint and index is supported by a given data source...
const OrderBy * getOrderBy() const
It returns the list of expressions used to sort the output result.
A class that can be used in a GROUP BY clause.
An abstract class that models a source of data in a query.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
boost::shared_ptr< DataSetType > DataSetTypePtr
This class models a XML reader object.
A class that models the name of a dataset used in a From clause.
TECOREEXPORT std::string URIEncode(const std::string &srcUri)
Encodes an decoded URI. The algorithm implementation is based on http://www.codeguru.com/cpp/cpp/algorithms/strings/article.php/c12759/URI-Encoding-and-Decoding.htm.
An SQL encoder for general function expressions.
TEDATAACCESSEXPORT te::da::DataSetType * ReadDataSetType(te::xml::Reader &reader)
const GroupBy * getGroupBy() const
It returns the list of expressions used to condense the result set.
virtual void writeStartElement(const std::string &qName)=0
It represents the system catalog of a DataSource.
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.
void setDataSetTypeCapabilities(const DataSetTypeCapabilities &capabilities)
A class that models the description of a dataset.
void addSpecificCapability(const std::string &key, const std::string &value)
virtual void writeValue(const std::string &value)=0
Expression * getExpression() const
It returns the expression set for an output select query.
Expression * getExpression() const
It returns the exprsssion to be used to sort the result of a query.
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
virtual Expression * clone() const =0
It creates a new copy of this expression.
static te::xml::AbstractWriter * make()
It creates a new XML writer using the dafault implementation.
It represents the SQL query dialect accepted by a given data source.
virtual std::string getElementLocalName() const =0
It returns the local part of the element name in the case of an element node.
virtual boost::uint32_t getAttrAsUInt32(std::size_t i) const
It returns the attribute value in the case of an element node with valid attributes.
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.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
std::size_t getNumberOfDataSets() const
It returns the number of datasets in the catalog.
void setAccessPolicy(const te::common::AccessPolicy &accessPolicy)
JoinType getType() const
It returns the join type.
static te::dt::Date ds(2010, 01, 01)
static te::xml::Reader * make()
It creates a new XML reader using the dafault implementation.
A class that informs what the dataset implementation of a given data source can perform.
void setRootNamespaceURI(const std::string &uri)
This class models a XML writer object.
TEDATAACCESSEXPORT te::da::Having * ReadHaving(te::xml::Reader &reader)
#define TE_TR(message)
It marks a string in order to get translated.
void setSupport(const int &type, const bool &support)
TEDATAACCESSEXPORT void Read(const std::string &dialectFileName, te::da::DataSourceCapabilities &capabilities, te::da::SQLDialect &dialect)
void setSupportDataSetTypePesistenceAPI(const bool &support)
void setQueryCapabilities(const QueryCapabilities &capabilities)
void insert(const std::string &funcName, SQLFunctionEncoder *encoder)
It adds a new encoder for a given function.
TEDATAACCESSEXPORT te::da::Function * ReadFunction(te::xml::Reader &reader)
const DataSetTypePtr & getDataSetType(std::size_t i) const
It returns the i-th dataset schema.
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.
virtual boost::int32_t getAttrAsInt32(const std::string &name) const
It returns the attribute value in the case of an element node with valid attributes.
A query encoder for binary operations.
SortOrder getSortOrder() const
It returns the order of sorting: Asc or Desc.
void setSupportTransactions(const bool &support)
te::da::SQLDialect * mydialect
A class that represents the supported data types of a specific data source.
AccessPolicy
Supported data access policies (can be used as bitfield).
void setSupportPreparedQueryAPI(const bool &support)
virtual std::string toString() const =0
It returns the data value in a string notation.
virtual void writeElement(const std::string &qName, const std::string &value)=0
virtual std::string getAttr(const std::string &name) const =0
It returns the attribute value in the case of an element node with valid attributes.
TEDATAACCESSEXPORT te::da::Where * ReadWhere(te::xml::Reader &reader)
A class that informs the query support of a given data source.
void setSupportDataSetPesistenceAPI(const bool &support)
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
virtual void writeToFile()=0
const std::string & getAlias() const
It returns the alias associated to the source item.
This class models a literal value.
te::da::DataSourceCapabilities capabilities
A condition to be used in a Join clause.
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
static te::dt::TimeDuration dt(20, 30, 50, 11)
TEDATAACCESSEXPORT void Save(const std::string &fileName)
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
JoinType
The type of join in a query.
TEDATAACCESSEXPORT te::da::From * ReadFrom(te::xml::Reader &reader)
A class that can be used to model a filter expression that can be applied to a query.
std::string * getAlias() const
It returns the alias for the outout expression.
TEDATAACCESSEXPORT te::da::Distinct * ReadDistinct(te::xml::Reader &reader)
A base class for values that can be retrieved from the data access module.
std::size_t getOffset() const
It tells the number of rows to skip before starting to return rows.
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
void setDataSetCapabilities(const DataSetCapabilities &capabilities)
A class that models a literal for double values.
TEDATAACCESSEXPORT te::da::FromItem * ReadFromItem(te::xml::Reader &reader)
std::size_t size() const
It returns the number of properties of the CompositeProperty.
te::common::AccessPolicy Convert2Terralib(std::string accessPolicy)
SortOrder
Sort order type: asc or desc.
void setAlias(std::string *alias)
As you know, sometimes is better to give an alias to an output expression.
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.
void setSupportSQLDialect(const bool &support)
TEDATAACCESSEXPORT te::da::OrderBy * ReadOrderBy(te::xml::Reader &reader)
TEDATAACCESSEXPORT te::da::GroupBy * ReadGroupBy(te::xml::Reader &reader)
A Select models a query to be used when retrieving data from a DataSource.
void setSupportBidirectionalTraversing(const bool &support)
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
A query encoder for binary operator expressions.
void setSupportBatchExecutorAPI(const bool &support)
FromItem * getSecond() const
It returns the second item involved in the join.
virtual int getTypeCode() const =0
It returns the data type code associated to the data value.
TEDATAACCESSEXPORT te::da::DataSourceCatalog * ReadDataSourceCatalog(te::xml::Reader &reader)
Where * getWhere() const
It returns the filter condition.
TEDATAACCESSEXPORT te::da::SQLDialect * ReadDialect(const std::string &dialectFileName)
JoinCondition * getCondition() const
It returns the join condition.
virtual void writeAttribute(const std::string &attName, const std::string &value)=0
JoinConditionUsing class can be used to model a USING clause in a Join.
A query encoder for unary operator expressions.
TEDATAACCESSEXPORT te::da::Select * ReadSelect(te::xml::Reader &reader)
void setDataTypeCapabilities(const DataTypeCapabilities &capabilities)
const Having * getHaving() const
It returns the list of expressions used to eliminate group row that doesn't satisfy the condition...
void setSupportPrimaryKey(const bool &support)
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
std::size_t getLimit() const
It tells the maximum number of rows to return.
const std::string & getName() const
It returns the dataset name.
TEDATAACCESSEXPORT te::da::Fields * ReadFields(te::xml::Reader &reader)
virtual void writeEndElement(const std::string &qName)=0
A class that represents a data source component.
virtual void writeStartDocument(const std::string &encoding, const std::string &standalone)=0
virtual std::string getElementValue() const =0
It returns the element data value in the case of VALUE node.
virtual NodeType getNodeType() const =0
It return the type of node read.
JoinConditionOn is a boolean expression and it specifies which items in a join are considered to matc...
TECOREEXPORT std::string URIDecode(const std::string &srcUri)
Decodes an encoded URI. The algorithm implementation is based on http://www.codeguru.com/cpp/cpp/algorithms/strings/article.php/c12759/URI-Encoding-and-Decoding.htm.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
Expression * getExpression() const
It returns the exprsssion to be used to sort the result of a query.
static bool isRegularFile(const std::string &path)
Checks if a given path in UTF-8 is a regular file.
virtual bool next()=0
It gets the next event to be read.
te::dt::AbstractData * getValue() const
It returns the value associated to the literal.
A base class for binary functions.
std::size_t getNumArgs() const
It returns the number of arguments informed to the function.
TEDATAACCESSEXPORT te::da::PropertyName * ReadPropertyName(te::xml::Reader &reader)
unsigned int getId() const
It returns the property identifier.
TEDATATYPEEXPORT int Convert2Terralib(const std::string &dataType)
It convert a string to a DataType.
TEDATAACCESSEXPORT te::da::Literal * ReadLiteral(te::xml::Reader &reader)
FromItem * getFirst() const
It returns the first from item involved in the join.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
TEDATAACCESSEXPORT void ReadDataSourceInfo(const std::string &datasourcesFileName)
const std::string & getTitle() const
A human descriptive title for the DataSetType.
A class that models a literal for Geometry values.
This class models a string Literal value.
const std::string & getName() const
It returns the property name.
static Geometry * read(const char *wkt)
It returns a valid Geometry from a given WKT.