|
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 |
|
7 * the Free Software Foundation, version 3. |
|
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 |
|
19 #include <memory> |
|
20 #include <string> |
|
21 #include <sstream> |
|
22 #include <regex> |
|
23 #include <vector> |
|
24 #include <locale> |
|
25 #include <codecvt> |
|
26 #include <unistd.h> |
|
27 #include <cassert> |
|
28 #include <sys/stat.h> |
|
29 |
|
30 #include <sqlite3.h> |
|
31 |
|
32 #include <relpipe/reader/typedefs.h> |
|
33 #include <relpipe/reader/TypeId.h> |
|
34 #include <relpipe/reader/handlers/RelationalReaderValueHandler.h> |
|
35 #include <relpipe/reader/handlers/AttributeMetadata.h> |
|
36 |
|
37 #include <relpipe/writer/Factory.h> |
|
38 |
|
39 #include "Configuration.h" |
|
40 #include "SqlException.h" |
|
41 #include "PreparedStatement.h" |
|
42 |
|
43 namespace relpipe { |
|
44 namespace tr { |
|
45 namespace sql { |
|
46 |
|
47 using namespace std; |
|
48 using namespace relpipe; |
|
49 using namespace relpipe::reader; |
|
50 using namespace relpipe::reader::handlers; |
|
51 |
|
52 class Connection { |
|
53 private: |
|
54 sqlite3* db; |
|
55 void begin(); |
|
56 public: |
|
57 Connection(const char* filename); |
|
58 virtual ~Connection(); |
|
59 PreparedStatement* prepareStatement(const char* sql); |
|
60 bool getAutoCommit(); |
|
61 void setAutoCommit(bool autoCommit); |
|
62 void commit(); |
|
63 void rollback(); |
|
64 }; |
|
65 |
|
66 } |
|
67 } |
|
68 } |