27 #include "../common/Exception.h" 
   28 #include "../common/Translator.h" 
   29 #include "../dataaccess/dataset/CheckConstraint.h" 
   30 #include "../dataaccess/dataset/DataSet.h" 
   31 #include "../dataaccess/dataset/ForeignKey.h" 
   32 #include "../dataaccess/dataset/Index.h" 
   33 #include "../dataaccess/dataset/ObjectIdSet.h" 
   34 #include "../dataaccess/dataset/PrimaryKey.h" 
   35 #include "../dataaccess/dataset/Sequence.h" 
   36 #include "../dataaccess/dataset/UniqueKey.h" 
   37 #include "../dataaccess/datasource/DataSourceCatalog.h" 
   38 #include "../dataaccess/datasource/ScopedTransaction.h" 
   39 #include "../dataaccess/query/Select.h" 
   40 #include "../dataaccess/query/SQLDialect.h" 
   41 #include "../dataaccess/utils/Utils.h" 
   42 #include "../datatype/Array.h" 
   43 #include "../datatype/Date.h" 
   44 #include "../datatype/DateTimeProperty.h" 
   45 #include "../datatype/Property.h" 
   46 #include "../datatype/SimpleData.h" 
   47 #include "../datatype/StringProperty.h" 
   48 #include "../geometry/Envelope.h" 
   49 #include "../geometry/GeometryProperty.h" 
   50 #include "../geometry/Utils.h" 
   51 #include "../geometry/Geometry.h" 
   52 #include "../memory/DataSet.h" 
   67 #include <boost/format.hpp> 
   68 #include <boost/lexical_cast.hpp> 
   71 #import "msado15.dll" \
 
   72   no_namespace rename(
"EOF", 
"EndOfFile")
 
   83   if(name == 
"lower_x" ||
 
   94     m_isInTransaction(false)
 
  115     m_conn->getConn()->BeginTrans();
 
  116     m_isInTransaction = 
true;
 
  128     m_conn->getConn()->CommitTrans();
 
  129     m_isInTransaction = 
false;
 
  141     m_conn->getConn()->RollbackTrans();
 
  142     m_isInTransaction = 
false;
 
  152   return m_isInTransaction;
 
  160   std::string sql(
"SELECT * FROM ");
 
  163   return query(sql, travType, connected, accessPolicy);
 
  167                                                                const std::string& propertyName,
 
  177   std::string lowerX = 
"lower_x";
 
  178   std::string upperX = 
"upper_x";
 
  179   std::string lowerY = 
"lower_y";
 
  180   std::string upperY = 
"upper_y";
 
  182   std::string q(
"SELECT * FROM " + name + 
" WHERE ");
 
  184   q += 
"NOT("+ lowerX +
" >= " + boost::lexical_cast<std::string>(e->
m_urx) + 
" OR ";
 
  185   q += upperX +
" <= " + boost::lexical_cast<std::string>(e->
m_llx) + 
" OR ";
 
  186   q += lowerY +
" >= " + boost::lexical_cast<std::string>(e->
m_ury) + 
" OR ";
 
  187   q += upperY +
" <= " + boost::lexical_cast<std::string>(e->
m_lly) + 
")";
 
  189   return query(q, travType, connected, accessPolicy);
 
  219   SQLVisitor visitor(*(m_ds->getDialect()), sql, m_conn->getConn());
 
  223   return query(sql, travType);
 
  231   _RecordsetPtr result = m_conn->query(query, connected);
 
  233   long i = result->GetRecordCount();
 
  235   std::auto_ptr<te::da::DataSet> dset(
new DataSet(
this, result));
 
  253   SQLVisitor visitor(*(m_ds->getDialect()), sql, m_conn->getConn());
 
  262   m_conn->execute(command);
 
  291   std::vector<std::string> datasets;
 
  293   ADOX::_CatalogPtr pCatalog = 0;
 
  295   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
  299     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  301     ADOX::TablesPtr tables = pCatalog->GetTables();
 
  303     for(
long i = 0; i < tables->GetCount(); ++i)
 
  305       ADOX::_TablePtr table = tables->GetItem(i);
 
  306       std::string tableName = table->GetName();
 
  308       std::string tabletype = table->GetType();
 
  310       if(table->GetType() == _bstr_t(
"ACCESS TABLE") || 
 
  311          table->GetType() == _bstr_t(
"LINK") || 
 
  312          table->GetType() == _bstr_t(
"PASS-THROUGH") ||
 
  313          table->GetType() == _bstr_t(
"SYSTEM TABLE") ||
 
  314          table->GetType() == _bstr_t(
"VIEW") ||
 
  315          table->GetType() == _bstr_t(
"GLOBAL TEMPORARY") ||
 
  316          tableName == 
"geometry_columns")
 
  319       datasets.push_back(std::string(table->GetName()));
 
  332   return getDataSetNames().size();
 
  341   getProperties(dt.get());
 
  343   getPrimaryKey(dt.get());
 
  345   getUniqueKeys(dt.get());
 
  347   getIndexes(dt.get());
 
  349   getCheckConstraints(dt.get());
 
  356   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  358   std::vector<te::dt::Property*> dtProperties = dt->getProperties();
 
  360   boost::ptr_vector<te::dt::Property> properties;
 
  362   for(std::size_t i = 0; i < dtProperties.size(); ++i)
 
  363     properties.push_back(dtProperties[i]->clone());
 
  370   if(!propertyExists(datasetName, name))
 
  371     throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no property with this name \"%2%\"!")) % datasetName % name).str());
 
  373   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  375   return std::auto_ptr<te::dt::Property>(dt->getProperty(name)->clone());
 
  380   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  382   assert(propertyPos < dt->size());
 
  384   return std::auto_ptr<te::dt::Property>(dt->getProperty(propertyPos)->clone());
 
  389   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  391   std::vector<std::string> pNames;
 
  393   std::size_t numProperties = dt->size();
 
  395   for(std::size_t i = 0; i < numProperties; ++i)
 
  396     pNames.push_back(dt->getProperty(i)->getName());
 
  403   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  410   std::vector<std::string> datasets;
 
  412   ADOX::_CatalogPtr pCatalog = 0;
 
  414   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
  418     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  420     ADOX::TablesPtr tables = pCatalog->GetTables();
 
  422     ADOX::_TablePtr table;
 
  424     for(
long i = 0; i < tables->GetCount(); ++i)
 
  427       table = tables->GetItem(i);
 
  428       std::string tableName = table->GetName();
 
  430       if(tableName == datasetName)
 
  438       ADOX::ColumnsPtr cols = table->GetColumns();
 
  440       for(
int i = 0; i < cols->Count; ++i)
 
  442         ADOX::_ColumnPtr col = cols->GetItem((
long)i);
 
  444         if(((LPCSTR)(_bstr_t)col->GetName()) == name)
 
  460   const std::string& propertyName = p->
getName();
 
  465   if(propertyExists(datasetName, propertyName))
 
  466     throw te::common::Exception((boost::format(
TE_TR(
"The dataset already \"%1%\" has a property with this name \"%2%\"!")) % datasetName % propertyName).str());
 
  468   ADOX::_CatalogPtr pCatalog = 0;
 
  470   ADOX::_TablePtr pTable = 0;
 
  472   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
  476     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  478     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  480     ADOX::_ColumnPtr newColumn = 0;
 
  482     TESTHR(newColumn.CreateInstance(__uuidof(ADOX::Column)));
 
  484     newColumn->PutName(propertyName.c_str());
 
  508           newColumn->PutAttributes(ADOX::adColNullable);
 
  510         pTable->Columns->Append(_variant_t ((IDispatch*)newColumn), ado_type, 0);
 
  524         newColumn->DefinedSize = ssize;
 
  527           newColumn->PutAttributes(ADOX::adColNullable);
 
  529         pTable->Columns->Append(_variant_t ((IDispatch*)newColumn), ado_type, ssize);
 
  537         if(propertyExists(datasetName, 
"lower_x"))
 
  543           newColumn->PutAttributes(ADOX::adColNullable);
 
  545         pTable->Columns->Append(_variant_t ((IDispatch*)newColumn), ado_type, 0);
 
  553         addProperty(datasetName, lowerX.get());
 
  554         addProperty(datasetName, lowerY.get());
 
  555         addProperty(datasetName, upperX.get());
 
  556         addProperty(datasetName, upperY.get());
 
  558         insertIntoGeometryColumns(datasetName, static_cast<te::gm::GeometryProperty*>(p));
 
  576   if(!propertyExists(datasetName, name))
 
  577     throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no property with this name \"%2%\"!")) % datasetName % name).str());
 
  579   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  583   ADOX::_CatalogPtr pCatalog = 0;
 
  585   ADOX::_TablePtr pTable = 0;
 
  587   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
  591     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  599       std::string sql  = 
"delete from geometry_columns where f_geometry_column = '";
 
  601                   sql += 
"' AND f_table_name = '";
 
  605       m_conn->execute(sql);
 
  615                                          const std::string& propertyName,
 
  616                                          const std::string& newPropertyName)
 
  618   ADOX::_CatalogPtr pCatalog = 0;
 
  620   ADOX::_TablePtr pTable = 0;
 
  622   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
  626     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  628     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  630     ADOX::_ColumnPtr col = pTable->GetColumns()->GetItem(propertyName.c_str());
 
  632     col->PutName(newPropertyName.c_str());
 
  634     pCatalog->GetTables()->Refresh();
 
  644   std::auto_ptr<te::dt::Property> prp(newProp);
 
  647   std::string sql(
"ALTER TABLE ");
 
  648   sql += datasetName + 
" ALTER COLUMN " + propName + 
" " + type; 
 
  655   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  657   return std::auto_ptr<te::da::PrimaryKey>(
static_cast<te::da::PrimaryKey*
>(dt->getPrimaryKey()->clone()));
 
  662   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  664   if(dt->getPrimaryKey()->getName() == name)
 
  672   _variant_t vOptional;
 
  673   vOptional.vt = VT_ERROR;
 
  674   vOptional.scode = DISP_E_PARAMNOTFOUND;
 
  676   ADOX::_KeyPtr pKey = 0;
 
  677   ADOX::_TablePtr pTable = 0;
 
  678   ADOX::_CatalogPtr pCatalog = 0;
 
  680   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
  681   TESTHR(pKey.CreateInstance(__uuidof(ADOX::Key)));
 
  685     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  687     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  689     pKey->Name = pTable->Name + 
"_pk";
 
  690     pKey->Type = ADOX::adKeyPrimary;
 
  699     TESTHR(pTable->Keys->Append(_variant_t((IDispatch *)pKey),ADOX::adKeyPrimary,vOptional,
L"",
L""));
 
  700     pCatalog->Tables->Refresh();
 
  710   ADOX::_KeyPtr pKey = 0;
 
  711   ADOX::_TablePtr pTable = 0;
 
  712   ADOX::_CatalogPtr pCatalog = 0;
 
  714   std::auto_ptr<te::da::PrimaryKey> pk(getPrimaryKey(datasetName));
 
  718     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  720     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  722     pKey = pTable->Keys->GetItem(pk->getName().c_str());
 
  724     TESTHR(pTable->GetKeys()->Delete(_variant_t((IDispatch *)pKey)));
 
  734   if(!foreignKeyExists(datasetName, name))
 
  735     throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no foreign key with this name \"%2%\"!")) % datasetName % name).str());
 
  737   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  739   return std::auto_ptr<te::da::ForeignKey>(
static_cast<te::da::ForeignKey*
>(dt->getForeignKey(name)->clone()));
 
  744   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  746   std::vector<std::string> fkNames;
 
  748   std::size_t numFK = dt->getNumberOfForeignKeys();
 
  750   for(std::size_t i = 0; i < numFK; ++i)
 
  751     fkNames.push_back(dt->getForeignKey(i)->getName());
 
  758   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  760   std::vector<std::string> fkNames = getForeignKeyNames(datasetName);
 
  762   if(std::find(fkNames.begin(), fkNames.end(), name) != fkNames.end())
 
  770   _variant_t vOptional;
 
  771   vOptional.vt = VT_ERROR;
 
  772   vOptional.scode = DISP_E_PARAMNOTFOUND;
 
  774   ADOX::_KeyPtr pKey = 0;
 
  775   ADOX::_TablePtr pTable = 0;
 
  776   ADOX::_CatalogPtr pCatalog = 0;
 
  780     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  782     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  784     TESTHR(pKey.CreateInstance(__uuidof(ADOX::Key)));
 
  786     pKey->Name = pTable->Name + 
"_fk";
 
  787     pKey->Type = ADOX::adKeyForeign;
 
  800     TESTHR(pTable->Keys->Append(_variant_t((IDispatch *)pKey),ADOX::adKeyPrimary,vOptional,
L"",
L""));
 
  802     pCatalog->Tables->Refresh();
 
  812   ADOX::_KeyPtr pKey = 0;
 
  813   ADOX::_TablePtr pTable = 0;
 
  814   ADOX::_CatalogPtr pCatalog = 0;
 
  819     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  821     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  823     pKey = pTable->Keys->GetItem(fkName.c_str());
 
  825     TESTHR(pTable->GetKeys()->Delete(_variant_t((IDispatch *)pKey)));
 
  835   if(!uniqueKeyExists(datasetName, name))
 
  836     throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no unique key with this name \"%2%\"!")) % datasetName % name).str());
 
  838   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  840   return std::auto_ptr<te::da::UniqueKey>(
static_cast<te::da::UniqueKey*
>(dt->getUniqueKey(name)->clone()));
 
  845   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  847   std::vector<std::string> ukNames;
 
  849   std::size_t numUKs = dt->getNumberOfUniqueKeys();
 
  851   for(std::size_t i = 0; i < numUKs; ++i)
 
  852     ukNames.push_back(dt->getUniqueKey(i)->getName());
 
  859   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  861   std::vector<std::string> ukNames = getUniqueKeyNames(datasetName);
 
  863   if(std::find(ukNames.begin(), ukNames.end(), name) != ukNames.end())
 
  871   _variant_t vOptional;
 
  872   vOptional.vt = VT_ERROR;
 
  873   vOptional.scode = DISP_E_PARAMNOTFOUND;
 
  875   ADOX::_KeyPtr pKey = 0;
 
  876   ADOX::_TablePtr pTable = 0;
 
  877   ADOX::_CatalogPtr pCatalog = 0;
 
  879   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
  880   TESTHR(pKey.CreateInstance(__uuidof(ADOX::Key)));
 
  884     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  886     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  888     pKey->Name = pTable->Name + 
"_uk";
 
  889     pKey->Type = ADOX::adKeyUnique;
 
  898     TESTHR(pTable->Keys->Append(_variant_t((IDispatch *)pKey),ADOX::adKeyUnique,vOptional,
L"",
L""));
 
  900     pCatalog->Tables->Refresh();
 
  910   ADOX::_KeyPtr pKey = 0;
 
  911   ADOX::_TablePtr pTable = 0;
 
  912   ADOX::_CatalogPtr pCatalog = 0;
 
  916     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
  918     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
  920     pKey = pTable->Keys->GetItem(name.c_str());
 
  922     TESTHR(pTable->GetKeys()->Delete(_variant_t((IDispatch *)pKey)));
 
  932   if(!checkConstraintExists(datasetName, name))
 
  933     throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no check constraint with this name \"%2%\"!")) % datasetName % name).str());
 
  935   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  937   return std::auto_ptr<te::da::CheckConstraint>(
static_cast<te::da::CheckConstraint*
>(dt->getCheckConstraint(name)->clone()));
 
  942   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  944   std::vector<std::string> ccNames;
 
  946   std::size_t numCCs = dt->getNumberOfCheckConstraints();
 
  948   for(std::size_t i = 0; i < numCCs; ++i)
 
  949     ccNames.push_back(dt->getCheckConstraint(i)->getName());
 
  956   std::vector<std::string> ccNames = getCheckConstraintNames(datasetName);
 
  958   if(std::find(ccNames.begin(), ccNames.end(), name) != ccNames.end())
 
  976   if(!indexExists(datasetName, name))
 
  977     throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no index with this name \"%2%\"!")) % datasetName % name).str());
 
  979   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  981   return std::auto_ptr<te::da::Index>(dt->getIndex(name)->clone());
 
  986   std::vector<std::string> idxNames;
 
  988   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
  990   std::size_t numIdxs = dt->getNumberOfIndexes();
 
  992   for(std::size_t i = 0; i < numIdxs; ++i)
 
  993     idxNames.push_back(dt->getIndex(i)->getName());
 
 1000   std::vector<std::string> idxNames = getIndexNames(datasetName);
 
 1002   if(std::find(idxNames.begin(), idxNames.end(), name) != idxNames.end())
 
 1009                                    const std::map<std::string, std::string>& options)
 
 1011   ADOX::_IndexPtr pIndex = 0;
 
 1012   ADOX::_TablePtr pTable = 0;
 
 1013   ADOX::_CatalogPtr pCatalog = 0;
 
 1015   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
 1016   TESTHR(pIndex.CreateInstance(__uuidof(ADOX::Index)));
 
 1020     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
 1022     pTable = pCatalog->Tables->GetItem(datasetName.c_str());
 
 1024     pIndex->Name = idx->
getName().c_str();
 
 1026     std::vector<te::dt::Property*> idxProps = idx->
getProperties();
 
 1027     for(
size_t i = 0; i < idxProps.size(); i++)
 
 1036     TESTHR(pTable->Indexes->Append(_variant_t((IDispatch *)pIndex)));
 
 1038   catch(_com_error& e)
 
 1046   if(!indexExists(datasetName, idxName))
 
 1047     throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no index with this name: \"%2%\"!")) % datasetName % idxName).str());
 
 1049   std::string sql(
"DROP INDEX ");
 
 1054   std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
 
 1087                                                                const std::string& )
 
 1089   if(!dataSetExists(datasetName))
 
 1092   std::string sql = 
"SELECT MIN(lower_x), MIN(lower_y), MAX(upper_x), MAX(upper_y) from " + datasetName;
 
 1094   std::auto_ptr<te::da::DataSet> resultBox(query(sql));
 
 1100     resultBox->moveFirst();
 
 1101     env->m_llx = resultBox->getDouble(0);
 
 1102     env->m_lly = resultBox->getDouble(1);
 
 1103     env->m_urx = resultBox->getDouble(2);
 
 1104     env->m_ury = resultBox->getDouble(3);
 
 1117   return getExtent(datasetName, 0);
 
 1122   std::auto_ptr<te::da::DataSet> result(getDataSet(datasetName));
 
 1124   return result->size();
 
 1129   std::vector<std::string> datasetNames = getDataSetNames();
 
 1131   if(datasetNames.empty())
 
 1139   std::vector<std::string> datasetNames = getDataSetNames();
 
 1141   if(std::find(datasetNames.begin(), datasetNames.end(), name) != datasetNames.end())
 
 1149   ADOX::_TablePtr pTable = 0;
 
 1150   ADOX::_CatalogPtr pCatalog = 0;
 
 1152   TESTHR(pTable.CreateInstance(__uuidof (ADOX::Table)));
 
 1153   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
 1157     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
 1159     pTable->Name = dt->
getName().c_str();
 
 1161     TESTHR(pCatalog->Tables->Append(_variant_t((IDispatch*)pTable)));
 
 1164   catch(_com_error &e)
 
 1169   std::size_t ncols = dt->
size();
 
 1171   for(std::size_t i = 0; i < ncols; ++i)
 
 1179                                        const std::string& ,
 
 1180                                        const std::map<std::string, std::string>& )
 
 1187   ADOX::_CatalogPtr pCatalog = 0;
 
 1189   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
 1193     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
 1195     TESTHR(pCatalog->Tables->Delete(name.c_str()));
 
 1197   catch(_com_error& e)
 
 1205   ADOX::_CatalogPtr pCatalog = 0;
 
 1207   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
 1211     pCatalog->Tables->GetItem(name.c_str())->PutName(newName.c_str());
 
 1213   catch(_com_error& e)
 
 1221                               const std::map<std::string, std::string>& options,
 
 1224   _RecordsetPtr recset;
 
 1225   TESTHR(recset.CreateInstance(__uuidof(Recordset)));
 
 1229     TESTHR(recset->Open(_bstr_t(datasetName.c_str()),
 
 1230       _variant_t((IDispatch*)m_conn->getConn(),
true), adOpenKeyset, adLockOptimistic, adCmdTable));
 
 1234       TESTHR(recset->AddNew());
 
 1254             recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)d->
getChar(pname.c_str());
 
 1258             recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)d->
getUChar(pname.c_str());
 
 1262             recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getInt16(pname.c_str());
 
 1266             recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getInt32(pname.c_str());
 
 1270             recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getInt64(pname.c_str());
 
 1279               double dval = boost::lexical_cast<
double>(sval);
 
 1280               recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)(dval);
 
 1286             std::auto_ptr<te::dt::DateTime> dtm(d->
getDateTime(i));
 
 1290             recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)dtt.c_str();
 
 1296             recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getFloat(pname.c_str());
 
 1300             recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getDouble(pname.c_str());
 
 1304             recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)d->
getString(pname.c_str()).c_str();
 
 1308             recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getBool(pname.c_str());
 
 1326             std::auto_ptr<te::gm::Geometry> geometry(d->
getGeometry(pname));
 
 1329             recset->GetFields()->GetItem(
"lower_x")->Value = (_variant_t)env->
m_llx;
 
 1330             recset->GetFields()->GetItem(
"lower_y")->Value = (_variant_t)env->m_lly;
 
 1331             recset->GetFields()->GetItem(
"upper_x")->Value = (_variant_t)env->m_urx;
 
 1332             recset->GetFields()->GetItem(
"upper_y")->Value = (_variant_t)env->m_ury;
 
 1337             recset->Fields->GetItem(pname.c_str())->AppendChunk (var);
 
 1348       TESTHR(recset->Update());
 
 1352   catch(_com_error& e)
 
 1360   ADOX::_CatalogPtr pCatalog = 0;
 
 1362   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
 1366     pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
 
 1368     TESTHR(pCatalog->Tables->Delete(datasetName.c_str()));
 
 1370   catch(_com_error& e)
 
 1378                                  const std::vector<std::size_t>& properties,
 
 1380                                  const std::map<std::string, std::string>& options,
 
 1388             const std::vector< std::set<int> >& properties,
 
 1389             const std::vector<size_t>& ids)
 
 1395   std::set<int>::iterator it;
 
 1403       std::string sql = 
"UPDATE " + datasetName + 
" SET "; 
 
 1404       plst = properties[i];
 
 1409       for(it = plst.begin(); it != plst.end(); ++it)
 
 1417           pName += 
"=\"" + dataset->
getAsString(*it) + 
"\"";
 
 1424       for(
size_t j=0; j<ids.size(); ++j)
 
 1437       sql += pName + 
" WHERE " + id;
 
 1461   _ConnectionPtr adoConn = m_conn->getConn();
 
 1463   ADOX::_CatalogPtr pCatalog = 0;
 
 1465   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
 1469     pCatalog->PutActiveConnection(variant_t((IDispatch *)adoConn));
 
 1471   catch(_com_error& e)
 
 1475   ADOX::TablesPtr tables = pCatalog->GetTables();
 
 1477   ADOX::_TablePtr t = tables->GetItem(dt->
getName().c_str());
 
 1479   ADOX::KeysPtr keys = t->GetKeys();
 
 1481   ADOX::_KeyPtr pk = 0;
 
 1483   for(
long i = 0; i < keys->Count; i++)
 
 1485     if(keys->GetItem(i)->GetType() == ADOX::adKeyPrimary)
 
 1486       pk = keys->GetItem(i);
 
 1495   ADOX::ColumnsPtr cols = pk->GetColumns();
 
 1499   for(
long i = 0; i < cols->GetCount(); i++)
 
 1500     tlPk->
add(dt->
getProperty(std::string(cols->GetItem(i)->GetName())));
 
 1505   std::string dsName = dt->
getName();
 
 1508   ADOX::DataTypeEnum colType;
 
 1509   std::map<int, std::string> colNamesMap;
 
 1510   std::map<int, ADOX::DataTypeEnum> colTypesMap;
 
 1511   std::map<int, int> charLengthMap;
 
 1512   std::map<int, bool> isRequiredMap;
 
 1513   std::map<int, bool> hasDefaultMap;
 
 1514   std::map<int, std::string> defaultValueMap;
 
 1516   _ConnectionPtr conn = 0;
 
 1522     conn = m_conn->getConn();
 
 1524     _RecordsetPtr rs = NULL;
 
 1526     TESTHR(rs.CreateInstance(__uuidof(Recordset)));
 
 1530     SAFEARRAY FAR* psa = NULL;
 
 1531     SAFEARRAYBOUND rgsabound;
 
 1535     rgsabound.lLbound = 0;
 
 1536     rgsabound.cElements = 3;
 
 1537     psa = SafeArrayCreate(VT_VARIANT, 1, &rgsabound);
 
 1539     var[0].vt = VT_EMPTY;
 
 1540     var[1].vt = VT_EMPTY;
 
 1541     var[2] = dsName.c_str();
 
 1544     for(LONG i = 0; i < 3; ++i)
 
 1545       hr = SafeArrayPutElement(psa, &i, &var[i]);
 
 1547     Array.vt = VT_ARRAY | VT_VARIANT;
 
 1550     rs = conn->OpenSchema(adSchemaColumns, &Array, vtMissing);
 
 1553     while (!(rs->EndOfFile))
 
 1556       _bstr_t columnName = rs->Fields->GetItem(
"COLUMN_NAME")->Value;
 
 1557       pos = rs->Fields->GetItem(
"ORDINAL_POSITION")->Value;
 
 1559       colNamesMap[pos] = (LPCSTR)columnName;
 
 1562       colType = ADOX::DataTypeEnum(
int(rs->Fields->GetItem(
"DATA_TYPE")->Value));
 
 1563       colTypesMap[pos] = colType;
 
 1566       _variant_t length = rs->Fields->GetItem(
"CHARACTER_MAXIMUM_LENGTH")->Value;
 
 1568       if(length.vt != VT_NULL)
 
 1569         charLength = (int)length.dblVal;
 
 1570       charLengthMap[pos] = charLength;
 
 1573       bool nullVal = rs->Fields->GetItem(
"IS_NULLABLE")->Value;
 
 1574       isRequiredMap[pos] = !nullVal;
 
 1577       bool hasDefault = rs->Fields->GetItem(
"COLUMN_HASDEFAULT")->Value;
 
 1578       hasDefaultMap[pos] = !hasDefault;
 
 1581       std::string defaultStr;
 
 1584         _bstr_t defaultValue = rs->Fields->GetItem(
"COLUMN_DEFAULT")->Value;
 
 1585          defaultStr = (LPSTR)defaultValue;
 
 1588       defaultValueMap[pos] = defaultStr;
 
 1594   catch (_com_error& e)
 
 1596     std::cout << 
"Error = " << (
char*) e.ErrorMessage() << std::endl;
 
 1600   for(
int i = 0; i < numCols; ++i)
 
 1603     ADOX::DataTypeEnum colType = colTypesMap[i];
 
 1604     std::string colName = colNamesMap[i];
 
 1620       case ::adLongVarChar:
 
 1621       case ::adLongVarWChar:
 
 1629         sp->
setSize(charLengthMap[i]);
 
 1634       case ADOX::adTinyInt:
 
 1635       case ADOX::adSmallInt:
 
 1636       case ADOX::adInteger:
 
 1637       case ADOX::adBigInt:
 
 1638       case ADOX::adSingle:
 
 1639       case ADOX::adDouble:
 
 1640       case ADOX::adDecimal:
 
 1641       case ::adUnsignedBigInt:
 
 1642       case ::adUnsignedInt:
 
 1643       case ::adUnsignedSmallInt:
 
 1644       case ::adUnsignedTinyInt:
 
 1653       case ADOX::adBinary:
 
 1654       case ADOX::adLongVarBinary:
 
 1657         std::map<std::string, std::string> geomColumns = m_ds->getGeomColumns();
 
 1658         std::map<std::string, std::string>::iterator it = geomColumns.find(dsName);
 
 1660         if(it != geomColumns.end())
 
 1662           if(it->second == colName)
 
 1676       case ADOX::adDBDate:
 
 1677       case ADOX::adDBTime:
 
 1678       case ADOX::adDBTimeStamp:
 
 1693   _ConnectionPtr adoConn = m_conn->getConn();
 
 1695   ADOX::_CatalogPtr pCatalog = 0;
 
 1697   TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
 
 1701     pCatalog->PutActiveConnection(variant_t((IDispatch *)adoConn));
 
 1703   catch(_com_error& e)
 
 1708   ADOX::TablesPtr tables = pCatalog->GetTables();
 
 1710   ADOX::_TablePtr t = tables->GetItem(dt->
getName().c_str());
 
 1712   ADOX::KeysPtr keys = t->GetKeys();  
 
 1714   for(
long i = 0; i < keys->Count; i++)
 
 1716     if(keys->GetItem(i)->GetType() == ADOX::adKeyUnique)
 
 1718       ADOX::_KeyPtr uk = keys->GetItem(i);
 
 1722       ADOX::ColumnsPtr cols = uk->GetColumns();
 
 1724       for(
long j = 0; j < cols->Count; j++)
 
 1725         tlUk->
add(dt->
getProperty(std::string(cols->GetItem(i)->GetName())));
 
 1732   _ConnectionPtr adoConn = m_conn->getConn();
 
 1734   ADOX::_CatalogPtr pCatalog = 0;
 
 1736   TESTHR((pCatalog.CreateInstance(__uuidof(ADOX::Catalog))));
 
 1740     pCatalog->PutActiveConnection(variant_t((IDispatch *)adoConn));
 
 1742   catch(_com_error& e)
 
 1747   ADOX::TablesPtr tables = pCatalog->GetTables();
 
 1749   ADOX::_TablePtr t = tables->GetItem(dt->
getName().c_str());
 
 1751   ADOX::IndexesPtr idxs = t->GetIndexes();
 
 1753   for(
long i = 0; i < idxs->GetCount(); i++)
 
 1755     ADOX::_IndexPtr idx = idxs->GetItem(i);
 
 1758     tlIdx->
setName(std::string(idx->GetName()));
 
 1760     std::vector<te::dt::Property*> props;
 
 1762     ADOX::ColumnsPtr cols = idx->GetColumns();
 
 1763     for(
long i = 0; i < cols->GetCount(); i++)
 
 1764       props.push_back(dt->
getProperty(std::string(cols->GetItem(i)->GetName())));
 
 1774   _RecordsetPtr rs = NULL;
 
 1776   std::string dtName = dt->
getName();
 
 1778   std::string str = 
"[" + dtName + 
"]";
 
 1784     _ConnectionPtr adoConn = m_conn->getConn();
 
 1786     TESTHR(rs.CreateInstance(__uuidof(Recordset)));
 
 1788     rs = adoConn->OpenSchema(adSchemaCheckConstraints);
 
 1790     while (!(rs->EndOfFile))
 
 1792       std::string constraintName = (LPCSTR)(bstr_t)(rs->Fields->GetItem(
"CONSTRAINT_NAME")->GetValue());
 
 1794       if(constraintName.find(str) != std::string::npos)
 
 1797         std::string checkClause = (LPCSTR)(bstr_t)(rs->Fields->GetItem(
"CHECK_CLAUSE")->GetValue());
 
 1804   catch(_com_error& e)
 
 1810   if(rs && rs->State == adStateOpen)
 
 1817   _ConnectionPtr adoConn = m_conn->getConn();
 
 1819   int coord_dimension = 2;
 
 1822     coord_dimension = 3;
 
 1824   _RecordsetPtr recset;
 
 1825   TESTHR(recset.CreateInstance(__uuidof(Recordset)));
 
 1829     TESTHR(recset->Open(_bstr_t(
"geometry_columns"),
 
 1830            _variant_t((IDispatch*)adoConn,
true), adOpenKeyset, adLockOptimistic, adCmdTable));
 
 1832     TESTHR(recset->AddNew());
 
 1834     recset->GetFields()->GetItem(
"f_table_catalog")->Value = (_bstr_t)std::string(
"''").c_str();
 
 1835     recset->GetFields()->GetItem(
"f_table_schema")->Value = (_bstr_t)std::string(
"public").c_str();
 
 1836     recset->GetFields()->GetItem(
"f_table_name")->Value = (_bstr_t)datasetName.c_str();
 
 1837     recset->GetFields()->GetItem(
"f_geometry_column")->Value = (_bstr_t)geomProp->
getName().c_str();
 
 1838     recset->GetFields()->GetItem(
"coord_dimension")->Value = (_variant_t)coord_dimension;
 
 1839     recset->GetFields()->GetItem(
"srid")->Value = (_variant_t)geomProp->
getSRID();
 
 1844   catch(_com_error& e)
 
 1849   m_ds->registerGeometryColumn(datasetName, geomProp->
getName());
 
Property * getProperty(std::size_t i) const 
It returns the i-th property. 
 
void add(te::dt::Property *p)
It adds the property to the list of properties that participates in the unique key. 
 
StringType
The subtype of string property. 
 
std::auto_ptr< te::da::DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. A dataset can be connected or disconnected. A connected dataset, after its creation through the data source transactor, continues to depend on the connection given by its associated data source. Differently, a disconnected dataset, after its creation, no more depends of the connection given by the data source, and it continues to live after the connection has been released to the data source. 
 
std::auto_ptr< te::da::BatchExecutor > getBatchExecutor()
It creates a batch command executor. 
 
virtual std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const =0
Method for retrieving a date and time attribute value. 
 
virtual boost::int16_t getInt16(std::size_t i) const =0
Method for retrieving a 16-bit integer attribute value (2 bytes long). 
 
std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset. 
 
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key. 
 
DataSet class implementation for Microsoft Access driver. 
 
void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset. 
 
std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset. 
 
void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset. 
 
int GetSRID(_ConnectionPtr adoConn, std::string tableName, std::string geomPropName)
Read the geometry_columns table end return a SRID. 
 
virtual boost::int32_t getInt32(std::size_t i) const =0
Method for retrieving a 32-bit integer attribute value (4 bytes long). 
 
std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source. 
 
void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset. 
 
void getIndexes(te::da::DataSetType *dt)
It update the DataSetType about the Indexes. 
 
An atomic property like an integer or double. 
 
CharEncoding
Supported charsets (character encoding). 
 
std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset. 
 
void getUniqueKeys(te::da::DataSetType *dt)
It update the DataSetType about the Unique Keys. 
 
std::auto_ptr< te::da::Index > getIndex(const std::string &datasetName, const std::string &name)
It gets the index with the given name from the dataset. 
 
const std::string & GetGeometryName(te::gm::GeomType t)
It returns the geometry OGC names. 
 
te::gm::GeomType GetType(_ConnectionPtr adoConn, std::string tableName, std::string geomPropName)
Read the geometry_columns table end return a geometry type. 
 
virtual char getChar(std::size_t i) const =0
Method for retrieving a signed character attribute value (1 byte long). 
 
void createDataSet(te::da::DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source. 
 
virtual bool getBool(std::size_t i) const =0
Method for retrieving a boolean attribute value. 
 
A class that models the description of a dataset. 
 
int Convert2Terralib(ADOX::DataTypeEnum adoType)
Bind ADOX Type to TerraLib Type. 
 
bool isInTransaction() const 
It returns true if a transaction is in progress, otherwise, it returns false. 
 
boost::int64_t getLastGeneratedId()
It returns the last id generated by an insertion command. 
 
std::auto_ptr< te::da::ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset. 
 
virtual boost::int64_t getInt64(std::size_t i) const =0
Method for retrieving a 64-bit integer attribute value (8 bytes long). 
 
void addForeignKey(const std::string &datasetName, te::da::ForeignKey *fk)
It adds a foreign key constraint to a dataset. 
 
void setSize(std::size_t s)
It sets the maximum number of characters for a varying string, or the number of characters for a fixe...
 
std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset. 
 
void addIndex(const std::string &datasetName, te::da::Index *idx, const std::map< std::string, std::string > &options)
It adds an index to the dataset. 
 
double m_urx
Upper right corner x-coordinate. 
 
PrimaryKey * getPrimaryKey() const 
It returns the primary key associated to the dataset type. 
 
SpatialRelation
Spatial relations between geometric objects. 
 
bool hasDataSets()
It checks if the data source has any dataset. 
 
It describes a sequence (a number generator). 
 
A visitor for building an SQL statement using ADO dialect. 
 
A class that describes a check constraint. 
 
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
 
std::string MakeConnectionStr(const std::map< std::string, std::string > &dsInfo)
Create a connection string based on a map. 
 
void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema. 
 
virtual std::string getNumeric(std::size_t i) const =0
Method for retrieving a numeric attribute value. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
std::string GetFormattedDateTime(te::dt::DateTime *dateTime)
It gets a formatted DateTime string for ADO. 
 
A class that implements a connection to a ADO database. 
 
std::size_t size() const 
It returns the maximum number of characters for a varying string, or the number of characters for a f...
 
It models a property definition. 
 
virtual double getDouble(std::size_t i) const =0
Method for retrieving a double attribute value. 
 
std::auto_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)
It retrieves the property with the given name from the dataset. 
 
bool isEnvelopeProperty(const std::string &name)
 
const std::vector< te::dt::Property * > & getProperties() const 
It returns the properties that take part of the primary key. 
 
void addSequence(te::da::Sequence *sequence)
It creates a new sequence in the data source. 
 
bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset. 
 
std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset. 
 
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection. 
 
AccessPolicy
Supported data access policies (can be used as bitfield). 
 
TraverseType
A dataset can be traversed in two ways: 
 
void cloneDataSet(const std::string &name, const std::string &cloneName, const std::map< std::string, std::string > &options)
It clones the dataset in the data source. 
 
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
 
Implementation of a dataset for the ADO driver. 
 
void add(const std::string &datasetName, te::da::DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit=0)
It adds data items to the dataset in the data source. 
 
std::string GetAdoStringType(const int &terralib)
Bind TerraLib type to an ADO valid fiel type name. 
 
double m_llx
Lower left corner x-coordinate. 
 
bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset. 
 
void optimize(const std::map< std::string, std::string > &opInfo)
For some data access drivers, this method will perform some operations to optimize the data storage...
 
bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source. 
 
void begin()
It starts a new transaction. 
 
int getSRID() const 
It returns the spatial reference system identifier associated to this property. 
 
void changePropertyDefinition(const std::string &datasetName, const std::string &propName, te::dt::Property *newProp)
 
virtual float getFloat(std::size_t i) const =0
Method for retrieving a float attribute value. 
 
An Envelope defines a 2D rectangular region. 
 
void addCheckConstraint(const std::string &datasetName, te::da::CheckConstraint *cc)
It adds a check constraint to the dataset. 
 
This class represents a set of unique ids created in the same context. i.e. from the same data set...
 
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos. 
 
std::auto_ptr< te::da::UniqueKey > getUniqueKey(const std::string &datasetName, const std::string &name)
It gets the unique key in the dataset with the given name. 
 
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL. 
 
void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset. 
 
void insertIntoGeometryColumns(const std::string &datasetName, te::gm::GeometryProperty *geomProp)
It insert a geometry property in the geometry_clumns (SFS Schema). 
 
std::string escape(const std::string &value)
It escapes a string for using in commands and queries. 
 
std::auto_ptr< te::da::PreparedQuery > getPrepared(const std::string &qName=std::string(""))
It creates a prepared query object that may be used for query commands (select, insert, update and delete) that are used repeatedly. 
 
GeomType getGeometryType() const 
It returns the geometry subtype allowed for the property. 
 
std::vector< std::string > getDataSetNames()
It It gets the dataset names available in the data source. 
 
void addUniqueKey(const std::string &datasetName, te::da::UniqueKey *uk)
It adds a unique key constraint to the dataset. 
 
void addPrimaryKey(const std::string &datasetName, te::da::PrimaryKey *pk)
It adds a primary key constraint to the dataset schema. 
 
DataSetType * getReferencedDataSetType() const 
It returns the referenced DataSetType of this foreign key constraint. 
 
bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset. 
 
void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the dataset schema. 
 
It models a foreign key constraint for a DataSetType. 
 
virtual std::string getAsString(std::size_t i, int precision=0) const 
Method for retrieving a data value as a string plain representation. 
 
bool isRequired() const 
It returns true if the attribute is required, otherwise it returns false. 
 
The type for string types: FIXED_STRING, VAR_STRING or STRING. 
 
It describes a unique key (uk) constraint. 
 
void setProperties(const std::vector< te::dt::Property * > &properties)
It sets the properties that take part of the index. 
 
Property * getParent() const 
It returns the parent of this property, or NULL, if it doesn't have one. 
 
std::size_t size() const 
It returns the number of properties of the CompositeProperty. 
 
void rollBack()
It aborts the transaction. Any changes will be rolled-back. 
 
A visitor for building an SQL statement using ADO dialect. 
 
std::auto_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset. 
 
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset. 
 
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
void dropDataSet(const std::string &name)
It removes the dataset schema from the data source. 
 
void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset. 
 
A Select models a query to be used when retrieving data from a DataSource. 
 
virtual std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value. 
 
void getCheckConstraints(te::da::DataSetType *dt)
It update the DataSetType about the Check Constraints. 
 
Connection * m_conn
The connection used by this transactor. 
 
double m_lly
Lower left corner y-coordinate. 
 
Implementation of the data source class for the ADO driver. 
 
void commit()
It commits the transaction. 
 
void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema. 
 
DataSourceTransactor class implementation for Microsoft Access driver. 
 
int getType() const 
It returns the property data type. 
 
void add(Constraint *c)
It adds a new constraint. 
 
std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source. 
 
A dataset is the unit of information manipulated by the data access module of TerraLib. 
 
const std::vector< te::dt::Property * > & getProperties() const 
It returns the properties that form the unique key. 
 
bool foreignKeyExists(const std::string &datasetName, const std::string &name)
It checks if a foreign key with the given name exists in the data source. 
 
te::common::CharEncoding getEncoding()
It return the DataSource current encoding. 
 
Utility functions for ADO. 
 
double m_ury
Upper right corner y-coordinate. 
 
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object. 
 
const std::vector< te::dt::Property * > & getProperties() const 
It returns the properties that take part of the index. 
 
std::auto_ptr< te::da::CheckConstraint > getCheckConstraint(const std::string &datasetName, const std::string &name)
It gets the check constraint of the dataset with the given name. 
 
It describes a primary key (pk) constraint. 
 
void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema. 
 
void setExpression(const std::string &e)
It sets the check constraint expression. 
 
ADOX::DataTypeEnum Convert2Ado(int terralib)
Bind TerraLib Type to ADO Type. 
 
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone. 
 
void setRequired(bool r)
It tells if the property is required or not. 
 
void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset. 
 
std::auto_ptr< te::da::DataSet > query(const te::da::Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It executes a query that may return some data using a generic query. A dataset can be connected or di...
 
A class that implements a connection to a ADO database. 
 
bool IsZProperty(te::gm::GeomType type)
Verifies whether Z property. 
 
void setName(const std::string &name)
It sets the index name. 
 
const std::map< std::string, std::string > & getConnectionInfo() const 
It returns the set of parameters used to set up the access channel to the underlying repository...
 
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute. 
 
te::da::DataSource * getDataSource() const 
It returns the parent data source of the transactor. 
 
std::auto_ptr< te::gm::Envelope > getExtent(const std::string &datasetName, const std::string &propertyName)
It retrieves the bounding rectangle of the spatial property for the given dataset. 
 
Transactor(DataSource *ds)
 
virtual unsigned char getUChar(std::size_t i) const =0
Method for retrieving an unsigned character attribute value (1 byte long). 
 
void update(const std::string &datasetName, te::da::DataSet *dataset, const std::vector< std::size_t > &properties, const te::da::ObjectIdSet *oids, const std::map< std::string, std::string > &options, std::size_t limit=0)
It updates the contents of a dataset for the set of data items. 
 
std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset. 
 
std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset. 
 
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos. 
 
const std::vector< te::dt::Property * > & getProperties() const 
It returns the properties that take part of the foreign key constraint. 
 
boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset. 
 
virtual bool moveFirst()=0
It moves the internal pointer to the first item in the collection. 
 
std::auto_ptr< te::da::Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source. 
 
const std::vector< te::dt::Property * > & getReferencedProperties() const 
It returns the referenced properties (on the referenced DataSetType) of this foreign key constraint...
 
bool checkConstraintExists(const std::string &datasetName, const std::string &name)
It checks if a check-constraint with the given name exists in the data source. 
 
void execute(const te::da::Query &command)
It executes the specified command using a generic query representation. 
 
void cancel()
It requests that the data source stop the processing of the current command. 
 
A Query is independent from the data source language/dialect. 
 
It describes an index associated to a DataSetType. 
 
An static class with global definitions. 
 
std::auto_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset. 
 
void setPrimaryKey(PrimaryKey *pk)
It sets the primary key constraint. 
 
bool uniqueKeyExists(const std::string &datasetName, const std::string &name)
It checks if a unique key with the given name exists in the dataset. 
 
void dropSequence(const std::string &name)
It removes the sequence from the data source. 
 
const std::string & getName() const 
It returns the property name. 
 
bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source. 
 
const std::string & getName() const 
It returns the index name.