author | František Kučera <franta-hg@frantovo.cz> |
Mon, 26 Oct 2020 00:00:35 +0100 | |
branch | v_0 |
changeset 53 | cc6ffeba0fe5 |
parent 36 | 91cb012d779a |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* Relational pipes |
|
3 |
* Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info) |
|
4 |
* |
|
5 |
* This program is free software: you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
10
7da7173d84b0
fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents:
8
diff
changeset
|
7 |
* the Free Software Foundation, version 3. |
0 | 8 |
* |
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
17 |
#pragma once |
|
18 |
||
36
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
19 |
#include <list> |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
20 |
#include <string> |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
21 |
#include <utility> |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
22 |
|
0 | 23 |
#include <relpipe/reader/typedefs.h> |
24 |
#include <relpipe/reader/TypeId.h> |
|
28
498d5d3406c3
remove unused includes
František Kučera <franta-hg@frantovo.cz>
parents:
27
diff
changeset
|
25 |
#include <relpipe/writer/TypeId.h> |
0 | 26 |
#include "SqlException.h" |
36
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
27 |
#include "ResultSet.h" |
0 | 28 |
|
29 |
namespace relpipe { |
|
30 |
namespace tr { |
|
31 |
namespace sql { |
|
32 |
||
3
0b932e05aa9f
sqlite wrapper objects + execute query
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
33 |
class PreparedStatement { |
0b932e05aa9f
sqlite wrapper objects + execute query
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
34 |
private: |
36
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
35 |
void* statement; |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
36 |
std::wstring_convert<std::codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
37 |
std::list<relpipe::reader::boolean_t> booleanParameters; |
53
cc6ffeba0fe5
fix: support bigger numbers, SQL_BIGINT
František Kučera <franta-hg@frantovo.cz>
parents:
36
diff
changeset
|
38 |
std::list<std::string> integerParameters; |
36
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
39 |
std::list<std::pair<std::string, long>> stringParameters; |
3
0b932e05aa9f
sqlite wrapper objects + execute query
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
40 |
public: |
30
629565ff82d3
keep sqlite3.h dependency in Connection.cpp and PreparedStatement.cpp only II
František Kučera <franta-hg@frantovo.cz>
parents:
29
diff
changeset
|
41 |
PreparedStatement(void* stmt); |
26
49919a60c747
move PreparedStatement class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
42 |
virtual ~PreparedStatement(); |
36
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
43 |
ResultSet* executeQuery(); |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
44 |
long executeUpdate(); |
26
49919a60c747
move PreparedStatement class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
45 |
void reset(); |
36
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
46 |
void setBoolean(int parameterNumber, relpipe::reader::boolean_t value); |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
47 |
void setInteger(int parameterNumber, relpipe::reader::integer_t value); |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
48 |
void setString(int parameterNumber, relpipe::reader::string_t value); |
91cb012d779a
use ODBC, avoid direct dependency on SQLite
František Kučera <franta-hg@frantovo.cz>
parents:
33
diff
changeset
|
49 |
void setNull(int parameterNumber); |
0 | 50 |
}; |
51 |
||
52 |
} |
|
53 |
} |
|
54 |
} |