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);
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 std::auto_ptr<te::da::DataSet> dset(
new DataSet(
this, result));
251 SQLVisitor visitor(*(m_ds->getDialect()), sql, m_conn->getConn());
260 m_conn->execute(command);
289 std::vector<std::string> datasets;
291 ADOX::_CatalogPtr pCatalog = 0;
293 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
297 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
299 ADOX::TablesPtr tables = pCatalog->GetTables();
301 for(
long i = 0; i < tables->GetCount(); ++i)
303 ADOX::_TablePtr table = tables->GetItem(i);
304 std::string tableName = table->GetName();
306 std::string tabletype = table->GetType();
308 if(table->GetType() == _bstr_t(
"ACCESS TABLE") ||
309 table->GetType() == _bstr_t(
"LINK") ||
310 table->GetType() == _bstr_t(
"PASS-THROUGH") ||
311 table->GetType() == _bstr_t(
"SYSTEM TABLE") ||
312 table->GetType() == _bstr_t(
"VIEW") ||
313 table->GetType() == _bstr_t(
"GLOBAL TEMPORARY") ||
314 tableName ==
"geometry_columns")
317 datasets.push_back(std::string(table->GetName()));
330 return getDataSetNames().size();
339 getProperties(dt.get());
341 getPrimaryKey(dt.get());
343 getUniqueKeys(dt.get());
345 getIndexes(dt.get());
347 getCheckConstraints(dt.get());
354 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
356 std::vector<te::dt::Property*> dtProperties = dt->getProperties();
358 boost::ptr_vector<te::dt::Property> properties;
360 for(std::size_t i = 0; i < dtProperties.size(); ++i)
361 properties.push_back(dtProperties[i]->clone());
368 if(!propertyExists(datasetName, name))
369 throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no property with this name \"%2%\"!")) % datasetName % name).str());
371 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
373 return std::auto_ptr<te::dt::Property>(dt->getProperty(name)->clone());
378 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
380 assert(propertyPos < dt->size());
382 return std::auto_ptr<te::dt::Property>(dt->getProperty(propertyPos)->clone());
387 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
389 std::vector<std::string> pNames;
391 std::size_t numProperties = dt->size();
393 for(std::size_t i = 0; i < numProperties; ++i)
394 pNames.push_back(dt->getProperty(i)->getName());
401 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
408 std::vector<std::string> datasets;
410 ADOX::_CatalogPtr pCatalog = 0;
412 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
416 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
418 ADOX::TablesPtr tables = pCatalog->GetTables();
420 ADOX::_TablePtr table;
422 for(
long i = 0; i < tables->GetCount(); ++i)
425 table = tables->GetItem(i);
426 std::string tableName = table->GetName();
428 if(tableName == datasetName)
436 ADOX::ColumnsPtr cols = table->GetColumns();
438 for(
int i = 0; i < cols->Count; ++i)
440 ADOX::_ColumnPtr col = cols->GetItem((
long)i);
442 if(((LPCSTR)(_bstr_t)col->GetName()) == name)
458 const std::string& propertyName = p->
getName();
463 if(propertyExists(datasetName, propertyName))
464 throw te::common::Exception((boost::format(
TE_TR(
"The dataset already \"%1%\" has a property with this name \"%2%\"!")) % datasetName % propertyName).str());
466 ADOX::_CatalogPtr pCatalog = 0;
468 ADOX::_TablePtr pTable = 0;
470 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
474 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
476 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
478 ADOX::_ColumnPtr newColumn = 0;
480 TESTHR(newColumn.CreateInstance(__uuidof(ADOX::Column)));
482 newColumn->PutName(propertyName.c_str());
506 newColumn->PutAttributes(ADOX::adColNullable);
508 pTable->Columns->Append(_variant_t ((IDispatch*)newColumn), ado_type, 0);
517 std::size_t ssize = 0;
522 newColumn->DefinedSize = (long)ssize;
525 newColumn->PutAttributes(ADOX::adColNullable);
527 pTable->Columns->Append(_variant_t ((IDispatch*)newColumn), ado_type, (
long)ssize);
535 if(propertyExists(datasetName,
"lower_x"))
541 newColumn->PutAttributes(ADOX::adColNullable);
543 pTable->Columns->Append(_variant_t ((IDispatch*)newColumn), ado_type, 0);
551 addProperty(datasetName, lowerX.get());
552 addProperty(datasetName, lowerY.get());
553 addProperty(datasetName, upperX.get());
554 addProperty(datasetName, upperY.get());
556 insertIntoGeometryColumns(datasetName, static_cast<te::gm::GeometryProperty*>(p));
574 if(!propertyExists(datasetName, name))
575 throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no property with this name \"%2%\"!")) % datasetName % name).str());
577 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
581 ADOX::_CatalogPtr pCatalog = 0;
583 ADOX::_TablePtr pTable = 0;
585 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
589 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
597 std::string sql =
"delete from geometry_columns where f_geometry_column = '";
599 sql +=
"' AND f_table_name = '";
603 m_conn->execute(sql);
613 const std::string& propertyName,
614 const std::string& newPropertyName)
616 ADOX::_CatalogPtr pCatalog = 0;
618 ADOX::_TablePtr pTable = 0;
620 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
624 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
626 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
628 ADOX::_ColumnPtr col = pTable->GetColumns()->GetItem(propertyName.c_str());
630 col->PutName(newPropertyName.c_str());
632 pCatalog->GetTables()->Refresh();
642 std::auto_ptr<te::dt::Property> prp(newProp);
645 std::string sql(
"ALTER TABLE ");
646 sql += datasetName +
" ALTER COLUMN " + propName +
" " + type;
653 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
655 return std::auto_ptr<te::da::PrimaryKey>(
static_cast<te::da::PrimaryKey*
>(dt->getPrimaryKey()->clone()));
660 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
662 if(dt->getPrimaryKey()->getName() == name)
670 _variant_t vOptional;
671 vOptional.vt = VT_ERROR;
672 vOptional.scode = DISP_E_PARAMNOTFOUND;
674 ADOX::_KeyPtr pKey = 0;
675 ADOX::_TablePtr pTable = 0;
676 ADOX::_CatalogPtr pCatalog = 0;
678 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
679 TESTHR(pKey.CreateInstance(__uuidof(ADOX::Key)));
683 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
685 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
687 pKey->Name = pTable->Name +
"_pk";
688 pKey->Type = ADOX::adKeyPrimary;
697 TESTHR(pTable->Keys->Append(_variant_t((IDispatch *)pKey),ADOX::adKeyPrimary,vOptional,
L"",
L""));
698 pCatalog->Tables->Refresh();
708 ADOX::_KeyPtr pKey = 0;
709 ADOX::_TablePtr pTable = 0;
710 ADOX::_CatalogPtr pCatalog = 0;
712 std::auto_ptr<te::da::PrimaryKey> pk(getPrimaryKey(datasetName));
716 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
718 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
720 pKey = pTable->Keys->GetItem(pk->getName().c_str());
722 TESTHR(pTable->GetKeys()->Delete(_variant_t((IDispatch *)pKey)));
732 if(!foreignKeyExists(datasetName, name))
733 throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no foreign key with this name \"%2%\"!")) % datasetName % name).str());
735 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
737 return std::auto_ptr<te::da::ForeignKey>(
static_cast<te::da::ForeignKey*
>(dt->getForeignKey(name)->clone()));
742 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
744 std::vector<std::string> fkNames;
746 std::size_t numFK = dt->getNumberOfForeignKeys();
748 for(std::size_t i = 0; i < numFK; ++i)
749 fkNames.push_back(dt->getForeignKey(i)->getName());
756 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
758 std::vector<std::string> fkNames = getForeignKeyNames(datasetName);
760 if(std::find(fkNames.begin(), fkNames.end(), name) != fkNames.end())
768 _variant_t vOptional;
769 vOptional.vt = VT_ERROR;
770 vOptional.scode = DISP_E_PARAMNOTFOUND;
772 ADOX::_KeyPtr pKey = 0;
773 ADOX::_TablePtr pTable = 0;
774 ADOX::_CatalogPtr pCatalog = 0;
778 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
780 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
782 TESTHR(pKey.CreateInstance(__uuidof(ADOX::Key)));
784 pKey->Name = pTable->Name +
"_fk";
785 pKey->Type = ADOX::adKeyForeign;
798 TESTHR(pTable->Keys->Append(_variant_t((IDispatch *)pKey),ADOX::adKeyPrimary,vOptional,
L"",
L""));
800 pCatalog->Tables->Refresh();
810 ADOX::_KeyPtr pKey = 0;
811 ADOX::_TablePtr pTable = 0;
812 ADOX::_CatalogPtr pCatalog = 0;
817 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
819 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
821 pKey = pTable->Keys->GetItem(fkName.c_str());
823 TESTHR(pTable->GetKeys()->Delete(_variant_t((IDispatch *)pKey)));
833 if(!uniqueKeyExists(datasetName, name))
834 throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no unique key with this name \"%2%\"!")) % datasetName % name).str());
836 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
838 return std::auto_ptr<te::da::UniqueKey>(
static_cast<te::da::UniqueKey*
>(dt->getUniqueKey(name)->clone()));
843 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
845 std::vector<std::string> ukNames;
847 std::size_t numUKs = dt->getNumberOfUniqueKeys();
849 for(std::size_t i = 0; i < numUKs; ++i)
850 ukNames.push_back(dt->getUniqueKey(i)->getName());
857 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
859 std::vector<std::string> ukNames = getUniqueKeyNames(datasetName);
861 if(std::find(ukNames.begin(), ukNames.end(), name) != ukNames.end())
869 _variant_t vOptional;
870 vOptional.vt = VT_ERROR;
871 vOptional.scode = DISP_E_PARAMNOTFOUND;
873 ADOX::_KeyPtr pKey = 0;
874 ADOX::_TablePtr pTable = 0;
875 ADOX::_CatalogPtr pCatalog = 0;
877 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
878 TESTHR(pKey.CreateInstance(__uuidof(ADOX::Key)));
882 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
884 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
886 pKey->Name = pTable->Name +
"_uk";
887 pKey->Type = ADOX::adKeyUnique;
896 TESTHR(pTable->Keys->Append(_variant_t((IDispatch *)pKey),ADOX::adKeyUnique,vOptional,
L"",
L""));
898 pCatalog->Tables->Refresh();
908 ADOX::_KeyPtr pKey = 0;
909 ADOX::_TablePtr pTable = 0;
910 ADOX::_CatalogPtr pCatalog = 0;
914 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
916 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
918 pKey = pTable->Keys->GetItem(name.c_str());
920 TESTHR(pTable->GetKeys()->Delete(_variant_t((IDispatch *)pKey)));
930 if(!checkConstraintExists(datasetName, name))
931 throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no check constraint with this name \"%2%\"!")) % datasetName % name).str());
933 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
935 return std::auto_ptr<te::da::CheckConstraint>(
static_cast<te::da::CheckConstraint*
>(dt->getCheckConstraint(name)->clone()));
940 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
942 std::vector<std::string> ccNames;
944 std::size_t numCCs = dt->getNumberOfCheckConstraints();
946 for(std::size_t i = 0; i < numCCs; ++i)
947 ccNames.push_back(dt->getCheckConstraint(i)->getName());
954 std::vector<std::string> ccNames = getCheckConstraintNames(datasetName);
956 if(std::find(ccNames.begin(), ccNames.end(), name) != ccNames.end())
974 if(!indexExists(datasetName, name))
975 throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no index with this name \"%2%\"!")) % datasetName % name).str());
977 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
979 return std::auto_ptr<te::da::Index>(dt->getIndex(name)->clone());
984 std::vector<std::string> idxNames;
986 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
988 std::size_t numIdxs = dt->getNumberOfIndexes();
990 for(std::size_t i = 0; i < numIdxs; ++i)
991 idxNames.push_back(dt->getIndex(i)->getName());
998 std::vector<std::string> idxNames = getIndexNames(datasetName);
1000 if(std::find(idxNames.begin(), idxNames.end(), name) != idxNames.end())
1007 const std::map<std::string, std::string>&)
1009 ADOX::_IndexPtr pIndex = 0;
1010 ADOX::_TablePtr pTable = 0;
1011 ADOX::_CatalogPtr pCatalog = 0;
1013 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
1014 TESTHR(pIndex.CreateInstance(__uuidof(ADOX::Index)));
1018 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
1020 pTable = pCatalog->Tables->GetItem(datasetName.c_str());
1022 pIndex->Name = idx->
getName().c_str();
1024 std::vector<te::dt::Property*> idxProps = idx->
getProperties();
1025 for(
size_t i = 0; i < idxProps.size(); i++)
1034 TESTHR(pTable->Indexes->Append(_variant_t((IDispatch *)pIndex)));
1036 catch(_com_error& e)
1044 if(!indexExists(datasetName, idxName))
1045 throw te::common::Exception((boost::format(
TE_TR(
"The dataset \"%1%\" has no index with this name: \"%2%\"!")) % datasetName % idxName).str());
1047 std::string sql(
"DROP INDEX ");
1052 std::auto_ptr<te::da::DataSetType> dt(getDataSetType(datasetName));
1085 const std::string& )
1087 if(!dataSetExists(datasetName))
1090 std::string sql =
"SELECT MIN(lower_x), MIN(lower_y), MAX(upper_x), MAX(upper_y) from " + datasetName;
1092 std::auto_ptr<te::da::DataSet> resultBox(query(sql));
1098 resultBox->moveFirst();
1099 env->m_llx = resultBox->getDouble(0);
1100 env->m_lly = resultBox->getDouble(1);
1101 env->m_urx = resultBox->getDouble(2);
1102 env->m_ury = resultBox->getDouble(3);
1115 return getExtent(datasetName, 0);
1120 std::auto_ptr<te::da::DataSet> result(getDataSet(datasetName));
1122 return result->size();
1127 std::vector<std::string> datasetNames = getDataSetNames();
1129 if(datasetNames.empty())
1137 std::vector<std::string> datasetNames = getDataSetNames();
1139 if(std::find(datasetNames.begin(), datasetNames.end(), name) != datasetNames.end())
1147 ADOX::_TablePtr pTable = 0;
1148 ADOX::_CatalogPtr pCatalog = 0;
1150 TESTHR(pTable.CreateInstance(__uuidof (ADOX::Table)));
1151 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
1155 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
1157 pTable->Name = dt->
getName().c_str();
1159 TESTHR(pCatalog->Tables->Append(_variant_t((IDispatch*)pTable)));
1162 catch(_com_error &e)
1167 std::size_t ncols = dt->
size();
1169 for(std::size_t i = 0; i < ncols; ++i)
1177 const std::string& ,
1178 const std::map<std::string, std::string>& )
1185 ADOX::_CatalogPtr pCatalog = 0;
1187 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
1191 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
1193 TESTHR(pCatalog->Tables->Delete(name.c_str()));
1195 catch(_com_error& e)
1203 ADOX::_CatalogPtr pCatalog = 0;
1205 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
1209 pCatalog->Tables->GetItem(name.c_str())->PutName(newName.c_str());
1211 catch(_com_error& e)
1219 const std::map<std::string, std::string>&,
1222 _RecordsetPtr recset;
1223 TESTHR(recset.CreateInstance(__uuidof(Recordset)));
1227 TESTHR(recset->Open(_bstr_t(datasetName.c_str()),
1228 _variant_t((IDispatch*)m_conn->getConn(),
true), adOpenKeyset, adLockOptimistic, adCmdTable));
1232 TESTHR(recset->AddNew());
1252 recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)d->
getChar(pname.c_str());
1256 recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)d->
getUChar(pname.c_str());
1260 recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getInt16(pname.c_str());
1264 recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getInt32(pname.c_str());
1268 recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getInt64(pname.c_str());
1277 double dval = boost::lexical_cast<
double>(sval);
1278 recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)(dval);
1284 std::auto_ptr<te::dt::DateTime> dtm(d->
getDateTime(i));
1288 recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)dtt.c_str();
1294 recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getFloat(pname.c_str());
1298 recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getDouble(pname.c_str());
1302 recset->GetFields()->GetItem(pname.c_str())->Value = (_bstr_t)d->
getString(pname.c_str()).c_str();
1306 recset->GetFields()->GetItem(pname.c_str())->Value = (_variant_t)d->
getBool(pname.c_str());
1324 std::auto_ptr<te::gm::Geometry> geometry(d->
getGeometry(pname));
1327 recset->GetFields()->GetItem(
"lower_x")->Value = (_variant_t)env->
m_llx;
1328 recset->GetFields()->GetItem(
"lower_y")->Value = (_variant_t)env->m_lly;
1329 recset->GetFields()->GetItem(
"upper_x")->Value = (_variant_t)env->m_urx;
1330 recset->GetFields()->GetItem(
"upper_y")->Value = (_variant_t)env->m_ury;
1335 recset->Fields->GetItem(pname.c_str())->AppendChunk (var);
1346 TESTHR(recset->Update());
1350 catch(_com_error& e)
1358 ADOX::_CatalogPtr pCatalog = 0;
1360 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
1364 pCatalog->PutActiveConnection(variant_t((IDispatch *)m_conn->getConn()));
1366 TESTHR(pCatalog->Tables->Delete(datasetName.c_str()));
1368 catch(_com_error& e)
1376 const std::vector<std::size_t>&,
1378 const std::map<std::string, std::string>&,
1386 const std::vector< std::set<int> >& properties,
1387 const std::vector<size_t>& ids)
1393 std::set<int>::iterator it;
1401 std::string sql =
"UPDATE " + datasetName +
" SET ";
1402 plst = properties[i];
1407 for(it = plst.begin(); it != plst.end(); ++it)
1415 pName +=
"=\"" + dataset->
getAsString(*it) +
"\"";
1422 for(
size_t j=0; j<ids.size(); ++j)
1435 sql += pName +
" WHERE " + id;
1459 _ConnectionPtr adoConn = m_conn->getConn();
1461 ADOX::_CatalogPtr pCatalog = 0;
1463 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
1467 pCatalog->PutActiveConnection(variant_t((IDispatch *)adoConn));
1469 catch(_com_error& e)
1473 ADOX::TablesPtr tables = pCatalog->GetTables();
1475 ADOX::_TablePtr t = tables->GetItem(dt->
getName().c_str());
1477 ADOX::KeysPtr keys = t->GetKeys();
1479 ADOX::_KeyPtr pk = 0;
1481 for(
long i = 0; i < keys->Count; i++)
1483 if(keys->GetItem(i)->GetType() == ADOX::adKeyPrimary)
1484 pk = keys->GetItem(i);
1493 ADOX::ColumnsPtr cols = pk->GetColumns();
1497 for(
long i = 0; i < cols->GetCount(); i++)
1498 tlPk->
add(dt->
getProperty(std::string(cols->GetItem(i)->GetName())));
1503 std::string dsName = dt->
getName();
1506 ADOX::DataTypeEnum colType;
1507 std::map<int, std::string> colNamesMap;
1508 std::map<int, ADOX::DataTypeEnum> colTypesMap;
1509 std::map<int, int> charLengthMap;
1510 std::map<int, bool> isRequiredMap;
1511 std::map<int, bool> hasDefaultMap;
1512 std::map<int, std::string> defaultValueMap;
1514 _ConnectionPtr conn = 0;
1520 conn = m_conn->getConn();
1522 _RecordsetPtr rs = NULL;
1524 TESTHR(rs.CreateInstance(__uuidof(Recordset)));
1528 SAFEARRAY FAR* psa = NULL;
1529 SAFEARRAYBOUND rgsabound;
1533 rgsabound.lLbound = 0;
1534 rgsabound.cElements = 3;
1535 psa = SafeArrayCreate(VT_VARIANT, 1, &rgsabound);
1537 var[0].vt = VT_EMPTY;
1538 var[1].vt = VT_EMPTY;
1539 var[2] = dsName.c_str();
1542 for(LONG i = 0; i < 3; ++i)
1543 hr = SafeArrayPutElement(psa, &i, &var[i]);
1545 Array.vt = VT_ARRAY | VT_VARIANT;
1548 rs = conn->OpenSchema(adSchemaColumns, &Array, vtMissing);
1551 while (!(rs->EndOfFile))
1554 _bstr_t columnName = rs->Fields->GetItem(
"COLUMN_NAME")->Value;
1555 pos = rs->Fields->GetItem(
"ORDINAL_POSITION")->Value;
1557 colNamesMap[pos] = (LPCSTR)columnName;
1560 colType = ADOX::DataTypeEnum(
int(rs->Fields->GetItem(
"DATA_TYPE")->Value));
1561 colTypesMap[pos] = colType;
1564 _variant_t length = rs->Fields->GetItem(
"CHARACTER_MAXIMUM_LENGTH")->Value;
1566 if(length.vt != VT_NULL)
1567 charLength = (int)length.dblVal;
1568 charLengthMap[pos] = charLength;
1571 bool nullVal = rs->Fields->GetItem(
"IS_NULLABLE")->Value;
1572 isRequiredMap[pos] = !nullVal;
1575 bool hasDefault = rs->Fields->GetItem(
"COLUMN_HASDEFAULT")->Value;
1576 hasDefaultMap[pos] = !hasDefault;
1579 std::string defaultStr;
1582 _bstr_t defaultValue = rs->Fields->GetItem(
"COLUMN_DEFAULT")->Value;
1583 defaultStr = (LPSTR)defaultValue;
1586 defaultValueMap[pos] = defaultStr;
1592 catch (_com_error& e)
1594 std::cout <<
"Error = " << (
char*) e.ErrorMessage() << std::endl;
1598 for(
int i = 0; i < numCols; ++i)
1601 ADOX::DataTypeEnum colType = colTypesMap[i];
1602 std::string colName = colNamesMap[i];
1618 case ::adLongVarChar:
1619 case ::adLongVarWChar:
1627 sp->
setSize(charLengthMap[i]);
1632 case ADOX::adTinyInt:
1633 case ADOX::adSmallInt:
1634 case ADOX::adInteger:
1635 case ADOX::adBigInt:
1636 case ADOX::adSingle:
1637 case ADOX::adDouble:
1638 case ADOX::adDecimal:
1639 case ::adUnsignedBigInt:
1640 case ::adUnsignedInt:
1641 case ::adUnsignedSmallInt:
1642 case ::adUnsignedTinyInt:
1651 case ADOX::adBinary:
1652 case ADOX::adLongVarBinary:
1655 std::map<std::string, std::string> geomColumns = m_ds->getGeomColumns();
1656 std::map<std::string, std::string>::iterator it = geomColumns.find(dsName);
1658 if(it != geomColumns.end())
1660 if(it->second == colName)
1674 case ADOX::adDBDate:
1675 case ADOX::adDBTime:
1676 case ADOX::adDBTimeStamp:
1691 _ConnectionPtr adoConn = m_conn->getConn();
1693 ADOX::_CatalogPtr pCatalog = 0;
1695 TESTHR(pCatalog.CreateInstance(__uuidof(ADOX::Catalog)));
1699 pCatalog->PutActiveConnection(variant_t((IDispatch *)adoConn));
1701 catch(_com_error& e)
1706 ADOX::TablesPtr tables = pCatalog->GetTables();
1708 ADOX::_TablePtr t = tables->GetItem(dt->
getName().c_str());
1710 ADOX::KeysPtr keys = t->GetKeys();
1712 for(
long i = 0; i < keys->Count; i++)
1714 if(keys->GetItem(i)->GetType() == ADOX::adKeyUnique)
1716 ADOX::_KeyPtr uk = keys->GetItem(i);
1720 ADOX::ColumnsPtr cols = uk->GetColumns();
1722 for(
long j = 0; j < cols->Count; j++)
1723 tlUk->
add(dt->
getProperty(std::string(cols->GetItem(i)->GetName())));
1730 _ConnectionPtr adoConn = m_conn->getConn();
1732 ADOX::_CatalogPtr pCatalog = 0;
1734 TESTHR((pCatalog.CreateInstance(__uuidof(ADOX::Catalog))));
1738 pCatalog->PutActiveConnection(variant_t((IDispatch *)adoConn));
1740 catch(_com_error& e)
1745 ADOX::TablesPtr tables = pCatalog->GetTables();
1747 ADOX::_TablePtr t = tables->GetItem(dt->
getName().c_str());
1749 ADOX::IndexesPtr idxs = t->GetIndexes();
1751 for(
long i = 0; i < idxs->GetCount(); i++)
1753 ADOX::_IndexPtr idx = idxs->GetItem(i);
1756 tlIdx->
setName(std::string(idx->GetName()));
1758 std::vector<te::dt::Property*> props;
1760 ADOX::ColumnsPtr cols = idx->GetColumns();
1761 for(
long i = 0; i < cols->GetCount(); i++)
1762 props.push_back(dt->
getProperty(std::string(cols->GetItem(i)->GetName())));
1772 _RecordsetPtr rs = NULL;
1774 std::string dtName = dt->
getName();
1776 std::string str =
"[" + dtName +
"]";
1780 _ConnectionPtr adoConn = m_conn->getConn();
1782 TESTHR(rs.CreateInstance(__uuidof(Recordset)));
1784 rs = adoConn->OpenSchema(adSchemaCheckConstraints);
1786 while (!(rs->EndOfFile))
1788 std::string constraintName = (LPCSTR)(bstr_t)(rs->Fields->GetItem(
"CONSTRAINT_NAME")->GetValue());
1790 if(constraintName.find(str) != std::string::npos)
1793 std::string checkClause = (LPCSTR)(bstr_t)(rs->Fields->GetItem(
"CHECK_CLAUSE")->GetValue());
1800 catch(_com_error& e)
1806 if(rs && rs->State == adStateOpen)
1813 _ConnectionPtr adoConn = m_conn->getConn();
1815 int coord_dimension = 2;
1818 coord_dimension = 3;
1820 _RecordsetPtr recset;
1821 TESTHR(recset.CreateInstance(__uuidof(Recordset)));
1825 TESTHR(recset->Open(_bstr_t(
"geometry_columns"),
1826 _variant_t((IDispatch*)adoConn,
true), adOpenKeyset, adLockOptimistic, adCmdTable));
1828 TESTHR(recset->AddNew());
1830 recset->GetFields()->GetItem(
"f_table_catalog")->Value = (_bstr_t)std::string(
"''").c_str();
1831 recset->GetFields()->GetItem(
"f_table_schema")->Value = (_bstr_t)std::string(
"public").c_str();
1832 recset->GetFields()->GetItem(
"f_table_name")->Value = (_bstr_t)datasetName.c_str();
1833 recset->GetFields()->GetItem(
"f_geometry_column")->Value = (_bstr_t)geomProp->
getName().c_str();
1834 recset->GetFields()->GetItem(
"coord_dimension")->Value = (_variant_t)coord_dimension;
1835 recset->GetFields()->GetItem(
"srid")->Value = (_variant_t)geomProp->
getSRID();
1840 catch(_com_error& e)
1845 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.