relpipe-in-cli.cpp
author František Kučera <franta-hg@frantovo.cz>
Sun, 22 Jul 2018 00:08:24 +0200
branchv_0
changeset 6 4585c212a767
parent 5 83dd71fe5cfd
child 7 9ac885dd8037
permissions -rw-r--r--
move create() method to a factory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#include <cstdlib>
1
7e43750deca8 shared library with pure abstract class (interface)
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     2
#include <memory>
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
1
7e43750deca8 shared library with pure abstract class (interface)
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     4
#include <RelationalWriter.h>
6
4585c212a767 move create() method to a factory
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
     5
#include <Factory.h>
5
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
     6
#include <TypeId.h>
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
int main(int argc, char** argv) {
5
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
     9
	using namespace relpipe::writer;
6
4585c212a767 move create() method to a factory
František Kučera <franta-hg@frantovo.cz>
parents: 5
diff changeset
    10
	std::shared_ptr<RelationalWriter> writer(Factory::create(std::cout));
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
3
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    12
	writer->startRelation(L"my_first_table",{
5
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    13
		{L"a1", TypeId::STRING},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    14
		{L"a2", TypeId::STRING},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    15
		{L"a3", TypeId::STRING}
3
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    16
	}, true);
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    17
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    18
	writer->writeRecord({L"1.1", L"1.2", L"1.3"});
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    19
	writer->writeRecord({L"2.1", L"2.2", L"2.3"});
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    20
	writer->writeRecord({L"3.1", L"3.2", L"3.3"});
4
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    21
	
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    22
	writer->startRelation(L"my_second_table",{
5
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    23
		{L"s", TypeId::STRING},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    24
		{L"i", TypeId::INTEGER},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    25
		{L"b", TypeId::BOOLEAN}
4
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    26
	}, true);
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    27
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    28
	writer->writeRecord({L"a", L"1", L"true"});
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    29
	writer->writeRecord({L"b", L"2", L"false"});
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    30
	writer->writeRecord({L"c", L"3", L"true"});
3
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    31
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    32
	return 0;
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
}