statement.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Tommi Maekitalo
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * As a special exception, you may use this file as part of a free
10  * software library without restriction. Specifically, if other files
11  * instantiate templates or use macros or inline functions from this
12  * file, or you compile this file and link it with other files to
13  * produce an executable, this file does not by itself cause the
14  * resulting executable to be covered by the GNU General Public
15  * License. This exception does not however invalidate any other
16  * reasons why the executable file might be covered by the GNU Library
17  * General Public License.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27  */
28 
29 #ifndef TNTDB_REPLICATE_STATEMENT_H
30 #define TNTDB_REPLICATE_STATEMENT_H
31 
32 #include <tntdb/iface/istatement.h>
33 #include <tntdb/statement.h>
34 #include <vector>
35 
36 namespace tntdb
37 {
38  namespace replicate
39  {
40  class Connection;
41 
42  class Statement : public IStatement
43  {
44  Connection* conn;
45  typedef std::vector<tntdb::Statement> Statements;
46  Statements statements;
47 
48  public:
49  Statement(Connection* conn, const std::string& query, const std::string& limit = std::string(), const std::string& offset = std::string());
50 
51  // methods of IStatement
52 
53  void clear();
54  void setNull(const std::string& col);
55  void setBool(const std::string& col, bool data);
56  void setShort(const std::string& col, short data);
57  void setInt(const std::string& col, int data);
58  void setLong(const std::string& col, long data);
59  void setUnsignedShort(const std::string& col, unsigned short data);
60  void setUnsigned(const std::string& col, unsigned data);
61  void setUnsignedLong(const std::string& col, unsigned long data);
62  void setInt32(const std::string& col, int32_t data);
63  void setUnsigned32(const std::string& col, uint32_t data);
64  void setInt64(const std::string& col, int64_t data);
65  void setUnsigned64(const std::string& col, uint64_t data);
66  void setDecimal(const std::string& col, const Decimal& data);
67  void setFloat(const std::string& col, float data);
68  void setDouble(const std::string& col, double data);
69  void setChar(const std::string& col, char data);
70  void setString(const std::string& col, const std::string& data);
71  void setBlob(const std::string& col, const Blob& data);
72  void setDate(const std::string& col, const Date& data);
73  void setTime(const std::string& col, const Time& data);
74  void setDatetime(const std::string& col, const Datetime& data);
75 
80  ICursor* createCursor(unsigned fetchsize);
81 
82  };
83  }
84 }
85 
86 #endif // TNTDB_REPLICATE_STATEMENT_H
87