relpipe-in-cli.cpp
branchv_0
changeset 5 83dd71fe5cfd
parent 4 e615c7d87279
child 6 4585c212a767
equal deleted inserted replaced
4:e615c7d87279 5:83dd71fe5cfd
     1 #include <cstdlib>
     1 #include <cstdlib>
     2 #include <memory>
     2 #include <memory>
     3 
     3 
     4 #include <RelationalWriter.h>
     4 #include <RelationalWriter.h>
       
     5 #include <TypeId.h>
     5 
     6 
     6 int main(int argc, char** argv) {
     7 int main(int argc, char** argv) {
     7 	std::shared_ptr<relpipe::writer::RelationalWriter> writer(relpipe::writer::RelationalWriter::create(std::cout));
     8 	using namespace relpipe::writer;
       
     9 	std::shared_ptr<RelationalWriter> writer(RelationalWriter::create(std::cout));
     8 
    10 
     9 	writer->startRelation(L"my_first_table",{
    11 	writer->startRelation(L"my_first_table",{
    10 		{L"a1", L"string"},
    12 		{L"a1", TypeId::STRING},
    11 		{L"a2", L"string"},
    13 		{L"a2", TypeId::STRING},
    12 		{L"a3", L"string"}
    14 		{L"a3", TypeId::STRING}
    13 	}, true);
    15 	}, true);
    14 
    16 
    15 	writer->writeRecord({L"1.1", L"1.2", L"1.3"});
    17 	writer->writeRecord({L"1.1", L"1.2", L"1.3"});
    16 	writer->writeRecord({L"2.1", L"2.2", L"2.3"});
    18 	writer->writeRecord({L"2.1", L"2.2", L"2.3"});
    17 	writer->writeRecord({L"3.1", L"3.2", L"3.3"});
    19 	writer->writeRecord({L"3.1", L"3.2", L"3.3"});
    18 	
    20 	
    19 	writer->startRelation(L"my_second_table",{
    21 	writer->startRelation(L"my_second_table",{
    20 		{L"s", L"string"},
    22 		{L"s", TypeId::STRING},
    21 		{L"i", L"integer"},
    23 		{L"i", TypeId::INTEGER},
    22 		{L"b", L"boolean"}
    24 		{L"b", TypeId::BOOLEAN}
    23 	}, true);
    25 	}, true);
    24 
    26 
    25 	writer->writeRecord({L"a", L"1", L"true"});
    27 	writer->writeRecord({L"a", L"1", L"true"});
    26 	writer->writeRecord({L"b", L"2", L"false"});
    28 	writer->writeRecord({L"b", L"2", L"false"});
    27 	writer->writeRecord({L"c", L"3", L"true"});
    29 	writer->writeRecord({L"c", L"3", L"true"});