27 #include "../common/Exception.h" 28 #include "../core/filesystem/FileSystem.h" 29 #include "../core/translator/Translator.h" 30 #include "../core/uri/Utils.h" 31 #include "../dataaccess/datasource/DataSourceTransactor.h" 32 #include "../dataaccess/query/SQLDialect.h" 33 #include "../datatype/StringProperty.h" 47 #include <boost/filesystem.hpp> 48 #include <boost/format.hpp> 49 #include <boost/lexical_cast.hpp> 92 _ConnectionPtr connection = conn->getConn();
131 const std::string& geomColName)
133 boost::lock_guard<boost::mutex> lock(
m_mtx);
139 const std::string& colName)
const 141 boost::lock_guard<boost::mutex> lock(
m_mtx);
143 std::map<std::string, std::string>::const_iterator it =
m_geomColumns.find(datasetName);
146 return it->second == colName;
158 ADOX::_CatalogPtr pCatalog = 0;
160 pCatalog.CreateInstance(__uuidof(ADOX::Catalog));
164 pCatalog->Create(connSTR.c_str());
170 std::string createMetaTables = kvp[
"CREATE_OGC_METADATA_TABLES"];
172 if(!createMetaTables.empty() && createMetaTables ==
"TRUE")
185 std::map<std::string, std::string> op;
200 std::string auxPath = auxURI.
host() + auxURI.
path();
202 boost::filesystem::path path(auxPath);
212 std::string auxPath = auxURI.
host() + auxURI.
path();
214 boost::filesystem::path path(auxPath);
223 std::string path = auxURI.
host() + auxURI.
path();
225 std::vector<std::string> names;
229 names.push_back(path);
237 boost::lock_guard<boost::mutex> lock(
m_mtx);
241 _RecordsetPtr recordset;
243 TESTHR(recordset.CreateInstance(__uuidof(Recordset)));
245 std::string
query =
"SELECT * FROM geometry_columns";
249 recordset->Open(query.c_str(), _variant_t((IDispatch *)adoConn), adOpenDynamic, adLockReadOnly, adCmdText);
251 while(!recordset->EndOfFile)
253 std::string tablename = (LPCSTR)(_bstr_t)recordset->GetFields()->GetItem(
"f_table_name")->GetValue();
255 std::string columnName = (LPCSTR)(_bstr_t)recordset->GetFields()->GetItem(
"f_geometry_column")->GetValue();
259 recordset->MoveNext();
The transactor class for the Microsoft Access driver.
static te::da::DataSourceCapabilities * sm_capabilities
The query dialect supported by ADO driver.
std::string path() const
Retrieving the path.
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
static bool exists(const std::string &path)
Checks if a given path in UTF-8 exists.
An atomic property like an integer or double.
bool isValid() const
It checks if the data source is valid (available for using).
A class that models the description of a dataset.
Utility functions for ADO.
void close()
It closes the data source and clears all the resources used by its internal communication channel...
virtual void createDataSet(DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
It represents the SQL query dialect accepted by a given data source.
An static class with global definitions.
std::map< std::string, std::string > m_geomColumns
The list of geometry columns.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
void create(const std::string &connInfo)
It creates a new data source.
#define TE_TR(message)
It marks a string in order to get translated.
A class that implements a connection to a ADO database.
std::string query() const
Retrieving the query.
virtual std::unique_ptr< DataSet > query(const Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It executes a query that may return some data using a generic query. This method always returns a dis...
std::vector< std::string > getDataSourceNames(const std::string &connInfo)
It gets the data source names available in a driver.
static bool remove(const std::string &path)
Removes a file or directory from a given path in UTF-8.
bool exists(const std::string &connInfo)
Check the existence of a data source in a driver.
std::unique_ptr< te::da::DataSourceTransactor > getTransactor()
It returns the set of parameters used to set up the access channel to the underlying repository...
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
static te::da::SQLDialect * sm_queryDialect
The query dialect supported by ADO driver.
void registerGeometryColumn(const std::string &datasetName, const std::string &geomColName)
std::string host() const
Retrieving the host.
The type for string types: FIXED_STRING, VAR_STRING or STRING.
const std::map< std::string, std::string > & getGeomColumns() const
Implementation of the data source class for the ADO driver.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
~DataSource()
Virtual destructor.
A class for representing an Uniform Resource Identifier (URI).
void add(Constraint *c)
It adds a new constraint.
bool isGeometryColumn(const std::string &datasetName, const std::string &colName) const
std::string MakeConnectionStr(const te::core::URI &connInfo)
Create a connection string based on a map.
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.
te::core::URI m_uri
The URI used to describe the datasource connection;.
TECOREEXPORT std::map< std::string, std::string > Expand(const std::string &query_str)
Split a query string into its components.
DataSource(const std::string &connInfo)
A class that implements a connection to a ADO database.
void loadGeometryColumnsCache(_ConnectionPtr &adoConn)
#define ADO_DRIVER_IDENTIFIER
The ADO driver identifier string.
DataSourceTransactor class implementation for Microsoft Access driver.
void drop(const std::string &connInfo)
It removes the data source with the connection information from a driver.
void open()
It opens the data source and makes it ready for using.