author | František Kučera <franta-hg@frantovo.cz> |
Tue, 30 Jul 2019 23:52:20 +0200 | |
branch | v_0 |
changeset 8 | 3e076cc76c89 |
parent 5 | cbc7817a3346 |
child 10 | 7da7173d84b0 |
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 |
|
7 |
* the Free Software Foundation, either version 3 of the License, or |
|
8 |
* (at your option) any later version. |
|
9 |
* |
|
10 |
* This program 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 General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
#pragma once |
|
19 |
||
20 |
#include <relpipe/writer/AttributeMetadata.h> |
|
21 |
#include <relpipe/writer/typedefs.h> |
|
22 |
||
23 |
namespace relpipe { |
|
24 |
namespace tr { |
|
25 |
namespace sql { |
|
26 |
||
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
27 |
class Parameter { |
0 | 28 |
public: |
29 |
||
30 |
relpipe::writer::string_t value; |
|
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
31 |
// TODO: relpipe::writer::TypeId type; |
0 | 32 |
}; |
33 |
||
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
34 |
class Statement { |
0 | 35 |
public: |
36 |
||
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
37 |
virtual ~Statement() { |
0 | 38 |
} |
39 |
||
40 |
/** |
|
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
41 |
* output relation name; |
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
42 |
* if empty, the SQL code (DML, DDL) will be executed, but no relational output will be generated |
0 | 43 |
*/ |
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
44 |
relpipe::writer::string_t relation; |
0 | 45 |
/** |
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
46 |
* SQL code, usually some SELECT; |
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
47 |
* might be also DML or DDL |
0 | 48 |
*/ |
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
49 |
relpipe::writer::string_t sql; |
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
50 |
std::vector<Parameter> parameters; |
0 | 51 |
}; |
52 |
||
53 |
class Configuration { |
|
54 |
public: |
|
55 |
||
5
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
56 |
|
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
57 |
/** |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
58 |
* By default, this transformation runs in-memory. |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
59 |
* If 'file' is not empty, this transformation will operate on an .sqlite file. |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
60 |
* The file will be created if it does not exist. |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
61 |
*/ |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
62 |
relpipe::writer::string_t file; |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
63 |
|
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
64 |
/** |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
65 |
* If true, the file (if any was created) will not be deleted when this transformation finishes. |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
66 |
*/ |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
67 |
relpipe::writer::boolean_t keepFile = false; |
cbc7817a3346
add option to create DB in a file and to keep that file
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
68 |
|
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
69 |
std::vector<Statement> statements; |
0 | 70 |
|
71 |
virtual ~Configuration() { |
|
72 |
} |
|
73 |
}; |
|
74 |
||
75 |
} |
|
76 |
} |
|
2
362f2689cb87
configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
77 |
} |