author | František Kučera <franta-hg@frantovo.cz> |
Wed, 25 Dec 2019 01:07:41 +0100 | |
branch | v_0 |
changeset 27 | 9441a517fa1f |
parent 26 | src/SqlHandler.h@49919a60c747 |
child 28 | 498d5d3406c3 |
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 |
||
19 |
#include <memory> |
|
20 |
#include <string> |
|
6
32b4293307f4
create table for each relation
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
21 |
#include <sstream> |
14
eacacf060755
add --dump option: allow pass through of relation specified by a regular expression
František Kučera <franta-hg@frantovo.cz>
parents:
12
diff
changeset
|
22 |
#include <regex> |
0 | 23 |
#include <vector> |
24 |
#include <locale> |
|
25 |
#include <codecvt> |
|
5
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
26 |
#include <unistd.h> |
8 | 27 |
#include <cassert> |
12
0b38339b871b
improve --keep-file option: default is auto = file will be kept, if it was present before the transformation
František Kučera <franta-hg@frantovo.cz>
parents:
11
diff
changeset
|
28 |
#include <sys/stat.h> |
0 | 29 |
|
1
eb7134dfdcc5
link to the sqlite3 library
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
30 |
#include <sqlite3.h> |
eb7134dfdcc5
link to the sqlite3 library
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
31 |
|
0 | 32 |
#include <relpipe/reader/typedefs.h> |
33 |
#include <relpipe/reader/TypeId.h> |
|
8 | 34 |
#include <relpipe/reader/handlers/RelationalReaderValueHandler.h> |
0 | 35 |
#include <relpipe/reader/handlers/AttributeMetadata.h> |
36 |
||
37 |
#include <relpipe/writer/Factory.h> |
|
38 |
||
39 |
#include "Configuration.h" |
|
40 |
#include "SqlException.h" |
|
26
49919a60c747
move PreparedStatement class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
41 |
#include "PreparedStatement.h" |
0 | 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 |
||
3
0b932e05aa9f
sqlite wrapper objects + execute query
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
52 |
class Connection { |
0b932e05aa9f
sqlite wrapper objects + execute query
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
53 |
private: |
0b932e05aa9f
sqlite wrapper objects + execute query
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
54 |
sqlite3* db; |
27
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
55 |
void begin(); |
3
0b932e05aa9f
sqlite wrapper objects + execute query
František Kučera <franta-hg@frantovo.cz>
parents:
1
diff
changeset
|
56 |
public: |
27
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
57 |
Connection(const char* filename); |
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
58 |
virtual ~Connection(); |
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
59 |
PreparedStatement* prepareStatement(const char* sql); |
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
60 |
bool getAutoCommit(); |
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
61 |
void setAutoCommit(bool autoCommit); |
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
62 |
void commit(); |
9441a517fa1f
move Connection class to separate .h and .cpp files
František Kučera <franta-hg@frantovo.cz>
parents:
26
diff
changeset
|
63 |
void rollback(); |
0 | 64 |
}; |
65 |
||
66 |
} |
|
67 |
} |
|
68 |
} |