relpipe-out-tabular.cpp
branchv_0
changeset 5 911ec74cce33
parent 3 9a4062b12fc9
child 9 86d69cfbacc9
--- a/relpipe-out-tabular.cpp	Sat Sep 08 19:44:51 2018 +0200
+++ b/relpipe-out-tabular.cpp	Sun Sep 09 02:00:00 2018 +0200
@@ -7,25 +7,11 @@
 #include <relpipe/reader/RelationalReader.h>
 #include <relpipe/reader/RelpipeReaderException.h>
 
+#include "src/TabularPrefetchingHandler.h"
 
 using namespace relpipe::cli;
 using namespace relpipe::reader;
-
-class DemoHandler : public handlers::RelationalReaderStringHadler {
-
-	void startRelation(string_t name, std::vector<std::pair<string_t, TypeId> > attributes) override {
-		std::wcout << L"start relation: " << name << std::endl << std::flush;
-		for (int i = 0; i < attributes.size(); i++) {
-			std::wcout << L"\tcolumn: " << attributes[i].first << L" / " << (int) attributes[i].second << std::endl << std::flush;
-		}
-	}
-
-	void attribute(const string_t& value) override {
-		std::wcout << L"attribute: " << value << std::endl << std::flush;
-	}
-
-
-};
+using namespace relpipe::out::tabular;
 
 int main(int argc, char** argv) {
 	CLI cli(argc, argv);
@@ -42,7 +28,7 @@
 		// }
 
 		std::shared_ptr<RelationalReader> reader(Factory::create(std::cin));
-		DemoHandler handler;
+		TabularPrefetchingHandler handler(std::cout);
 		reader->addHandler(&handler);
 		reader->process();