DataSource.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/sqlite/DataSource.h
22 
23  \brief Implements the DataSource class for the SQLite Data Access Driver.
24 */
25 
26 #ifndef __TERRALIB_SQLITE_INTERNAL_DATASOURCE_H
27 #define __TERRALIB_SQLITE_INTERNAL_DATASOURCE_H
28 
29 // TerraLib
30 #include "../dataaccess/datasource/DataSource.h"
31 
32 namespace te
33 {
34  namespace sqlite
35  {
37  {
38  public:
39 
40  DataSource();
41 
42  ~DataSource();
43 
44  std::string getType() const;
45 
46  const std::map<std::string, std::string>& getConnectionInfo() const;
47 
48  void setConnectionInfo(const std::map<std::string, std::string>& connInfo);
49 
50  std::auto_ptr<te::da::DataSourceTransactor> getTransactor();
51 
52  void open();
53 
54  void close();
55 
56  bool isOpened() const;
57 
58  bool isValid() const;
59 
61 
62  const te::da::SQLDialect* getDialect() const;
63 
65 
66  static void set(te::da::SQLDialect* dialect);
67 
68  protected:
69 
70  void create(const std::map<std::string, std::string>& dsInfo);
71 
72  void drop(const std::map<std::string, std::string>& dsInfo);
73 
74  bool exists(const std::map<std::string, std::string>& dsInfo);
75 
76  std::vector<std::string> getDataSourceNames(const std::map<std::string, std::string>& dsInfo);
77 
78  std::vector<std::string> getEncodings(const std::map<std::string, std::string>& dsInfo);
79 
80  private:
81 
82  class Impl;
83 
84  Impl* m_pImpl;
85  };
86 
87  }
88 }
89 
90 #endif // __TERRALIB_SQLITE_INTERNAL_DATASOURCE_H
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
~DataSource()
Virtual destructor.
te::da::SQLDialect * dialect
Definition: WFSDialect.h:1
void drop(const std::map< std::string, std::string > &dsInfo)
It removes the data source with the connection information from a driver.
std::vector< std::string > getDataSourceNames(const std::map< std::string, std::string > &dsInfo)
It gets the data source names available in a driver.
std::vector< std::string > getEncodings(const std::map< std::string, std::string > &dsInfo)
It gets the encodings for the data source.
bool isValid() const
It checks if the data source is valid (available for using).
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:55
void create(const std::map< std::string, std::string > &dsInfo)
It creates a new data source.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
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...
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
te::da::DataSourceCapabilities capabilities
void setConnectionInfo(const std::map< std::string, std::string > &connInfo)
It sets the connection information to be used when connecting to the data source. ...
URI C++ Library.
static void set(te::da::DataSourceCapabilities *capabilities)
void open()
It opens the data source and makes it ready for using.
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.
std::auto_ptr< te::da::DataSourceTransactor > getTransactor()
It returns an object that can execute transactions in the context of a data source.
bool exists(const std::map< std::string, std::string > &dsInfo)
Check the existence of a data source in a driver.
void close()
It closes the data source and clears all the resources used by its internal communication channel...