src/AwkHandler.h
branchv_0
changeset 26 cf57e8c78492
parent 25 13a1e1134797
child 27 86d8bbc99e7b
--- a/src/AwkHandler.h	Wed May 22 19:26:10 2019 +0200
+++ b/src/AwkHandler.h	Thu May 23 23:35:52 2019 +0200
@@ -226,6 +226,18 @@
 		closeOrThrow(awkOutputReaderFD);
 	}
 
+	void debugVariableMapping(const string_t& relationName) {
+		relationalWriter->startRelation(relationName + L".variableMapping",{
+			{L"attribute", writer::TypeId::STRING},
+			{L"variable", writer::TypeId::STRING},
+		}, true);
+
+		for (std::pair<string_t, string_t> m : currenVariablesMapping) {
+			relationalWriter->writeAttribute(m.first);
+			relationalWriter->writeAttribute(m.second);
+		}
+	}
+
 public:
 
 	/**
@@ -370,6 +382,8 @@
 					// Writer child process
 					closeOrThrow(awkInputWriterFD);
 
+					if (currentRelationConfiguration->debugVariableMapping) debugVariableMapping(name);
+
 					if (currentRelationConfiguration->drop) {
 						// TODO: omit whole this process and pipe AWK output to /dev/null?
 					} else {