All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PreparedQuery.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/PreparedQuery.h
22 
23  \brief A class that implements a prepared query for the TerraLib SQLite Data Access Driver.
24 */
25 
26 #ifndef __TERRALIB_SQLITE_INTERNAL_PREPAREDQUERY_H
27 #define __TERRALIB_SQLITE_INTERNAL_PREPAREDQUERY_H
28 
29 // TerraLib
30 #include "../dataaccess/datasource/PreparedQuery.h"
31 #include "Config.h"
32 
33 // STL
34 #include <vector>
35 
36 // Boost
37 #include <boost/cstdint.hpp>
38 
39 // Forward declarations
40 extern "C"
41 {
42  struct sqlite3_stmt;
43  typedef struct sqlite3_stmt sqlite3_stmt;
44 }
45 
46 
47 namespace te
48 {
49 // Forward declarations
50  namespace da
51  {
52  class DataSetType;
53  }
54 
55  namespace sqlite
56  {
57 // Forward declarations
58  class DataSet;
59  class DataSourceTransactor;
60 
61  /*!
62  \class PreparedQuery
63 
64  \brief A class that implements a prepared query for the TerraLib SQLite Data Access Driver
65 
66  \sa te::da::PreparedQuery
67  */
69  {
70  public:
71 
73 
75 
76  std::string getName() const;
77 
78  void prepare(const te::da::Query& query, const std::vector<te::dt::Property*>& paramTypes);
79 
80  void prepare(const std::string& query, const std::vector<te::dt::Property*>& paramTypes);
81 
82  void execute();
83 
86 
87  void bind(int i, char value);
88 
89  void bind(int i, unsigned char value);
90 
91  void bind(int i, boost::int16_t value);
92 
93  void bind(int i, boost::int32_t value);
94 
95  void bind(int i, boost::int64_t value);
96 
97  void bind(int i, bool value);
98 
99  void bind(int i, float value);
100 
101  void bind(int i, double value);
102 
103  void bindNumeric(int i, const std::string& value);
104 
105  void bind(int i, const std::string& value);
106 
107  void bind(int i, const te::dt::ByteArray& value);
108 
109  void bind(int i, const te::gm::Geometry& value);
110 
111  void bind(int i, const te::rst::Raster& value);
112 
113  void bind(int i, const te::dt::DateTime& value);
114 
115  void bind(int i, const te::da::DataSet& value);
116 
117  void bind(int i, const te::dt::AbstractData& ad);
118 
120 
121  void prepare(const std::string& query);
122 
123  void bind(const std::vector<std::size_t>& propertiesPos, std::size_t offset, te::da::DataSet* d);
124 
125  void bind(const std::vector<std::size_t>& propertiesPos, te::da::DataSet* d);
126 
127  void bind(te::da::DataSet* d);
128 
129  private:
130 
134  };
135 
136  } // end namespace sqlite
137 } // end namespace te
138 
139 
140 #endif // __TERRALIB_SQLITE_INTERNAL_PREPAREDQUERY_H
141 
142 
Configuration flags for the SQLite Data Access driver.
A class that model a prepared query.
Definition: PreparedQuery.h:69
struct sqlite3 sqlite3
void prepare(const te::da::Query &query, const std::vector< te::dt::Property * > &paramTypes)
It prepares the query that may be used for commands that are used mutiple times (select, insert, update and delete).
te::da::DataSet * query(te::common::TraverseType travType=te::common::FORWARDONLY, te::common::AccessPolicy rwRole=te::common::RAccess)
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:53
PreparedQuery()
Constructor.
Definition: PreparedQuery.h:74
An abstract class for raster data strucutures.
Definition: Raster.h:71
std::string getName() const
It returns the prepared query name.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
void bind(int i, char value)
Binds the i-th parameter of the query to a value.
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
A class that implements a prepared query for the TerraLib SQLite Data Access Driver.
Definition: PreparedQuery.h:68
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
DataSourceTransactor * m_t
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
~PreparedQuery()
Virtual destructor.
void bindNumeric(int i, const std::string &value)
Binds the i-th parameter of the query to a value.
struct sqlite3_stmt sqlite3_stmt
Definition: FwDataSet.h:35
te::da::DataSourceTransactor * getTransactor() const
It returns a pointer to the underlying data source transactor.
A Query is independent from the data source language/dialect.
Definition: Query.h:46
A class for representing binary data.
Definition: ByteArray.h:51