pass only values to the awk process v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 07 May 2019 17:03:07 +0200
branchv_0
changeset 17 54716ea44d52
parent 16 4e8fe4cc70f0
child 18 2ac59242d0cb
pass only values to the awk process
src/AwkHandler.h
--- a/src/AwkHandler.h	Tue May 07 16:38:12 2019 +0200
+++ b/src/AwkHandler.h	Tue May 07 17:03:07 2019 +0200
@@ -257,20 +257,14 @@
 
 	void attribute(const string_t& value) override {
 		if (currentRelationConfiguration) {
-			string_t variableName = a2v(currentReaderMetadata[currentAttributeIndex].getAttributeName());
-			string_t variableValue = escapeAwkValue(value);
-
 			currentAttributeIndex++;
 			currentAttributeIndex = currentAttributeIndex % currentReaderMetadata.size();
 
-			// TODO: just the value – move name to the AWK function
-			std::string variablePair = convertor.to_bytes(variableName + L"=" + variableValue);
+			std::string awkValue = convertor.to_bytes(escapeAwkValue(value));
+			if (currentAttributeIndex == 0) awkValue += "\n";
+			else awkValue += "\t";
 
-			if (currentAttributeIndex == 0) variablePair += "\n";
-			else variablePair += "\t";
-
-			write(awkInputWriterFD, variablePair.c_str(), variablePair.length());
-
+			write(awkInputWriterFD, awkValue.c_str(), awkValue.length());
 		} else {
 			relationalWriter->writeAttribute(value);
 		}