relpipe-in-cli.cpp
author František Kučera <franta-hg@frantovo.cz>
Sat, 21 Jul 2018 23:47:09 +0200
branchv_0
changeset 5 83dd71fe5cfd
parent 4 e615c7d87279
child 6 4585c212a767
permissions -rw-r--r--
use TypeId enum instead of numeric constants
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>
5
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
     5
#include <TypeId.h>
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
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
     8
	using namespace relpipe::writer;
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
     9
	std::shared_ptr<RelationalWriter> writer(RelationalWriter::create(std::cout));
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
3
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    11
	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
    12
		{L"a1", TypeId::STRING},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    13
		{L"a2", TypeId::STRING},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    14
		{L"a3", TypeId::STRING}
3
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    15
	}, true);
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    16
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    17
	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
    18
	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
    19
	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
    20
	
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    21
	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
    22
		{L"s", TypeId::STRING},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    23
		{L"i", TypeId::INTEGER},
83dd71fe5cfd use TypeId enum instead of numeric constants
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    24
		{L"b", TypeId::BOOLEAN}
4
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    25
	}, true);
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    26
e615c7d87279 multiple relations, various data types
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    27
	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
    28
	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
    29
	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
    30
7d4525147bf7 multiple records, no nullptr
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    31
	return 0;
0
3dd6adb7e191 empty project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
}