src/StreamRelationalWriter.h
branchv_0
changeset 47 77fbaccdeea4
parent 41 744b61559eb2
child 52 785fc49b0a55
equal deleted inserted replaced
46:36245d405b8a 47:77fbaccdeea4
    86 		string_t tableName = name;
    86 		string_t tableName = name;
    87 		columnCount = attributes.size();
    87 		columnCount = attributes.size();
    88 		currentColumn = 0;
    88 		currentColumn = 0;
    89 
    89 
    90 		// Write table name and column count:
    90 		// Write table name and column count:
    91 		integerWriter.writeValue(output, DATA_PART_START);
    91 		if (writeHeader) {
    92 		stringWriter.writeValue(output, tableName);
    92 			integerWriter.writeValue(output, DATA_PART_START);
    93 		integerWriter.writeValue(output, columnCount);
    93 			stringWriter.writeValue(output, tableName);
       
    94 			integerWriter.writeValue(output, columnCount);
       
    95 		}
    94 
    96 
    95 		columnTypes.clear();
    97 		columnTypes.clear();
    96 		columnTypes.resize(columnCount);
    98 		columnTypes.resize(columnCount);
    97 
    99 
    98 		// Write column names:
   100 		// Write column names:
    99 		for (size_t c = 0; c < columnCount; c++) {
   101 		if (writeHeader) {
   100 			wstring columnName = attributes[c].attributeName;
   102 			for (size_t c = 0; c < columnCount; c++) {
   101 			stringWriter.writeValue(output, columnName);
   103 				wstring columnName = attributes[c].attributeName;
       
   104 				stringWriter.writeValue(output, columnName);
       
   105 			}
   102 		}
   106 		}
   103 
   107 
   104 		// Write column types:
   108 		// Write column types:
   105 		for (size_t c = 0; c < columnCount; c++) {
   109 		for (size_t c = 0; c < columnCount; c++) {
   106 			TypeId typeId = attributes[c].typeId;
   110 			TypeId typeId = attributes[c].typeId;
   107 			integerWriter.writeValue(output, static_cast<integer_t> (typeId));
   111 			if (writeHeader) integerWriter.writeValue(output, static_cast<integer_t> (typeId));
   108 			columnTypes[c] = typeId;
   112 			columnTypes[c] = typeId;
   109 		}
   113 		}
   110 
   114 
   111 	}
   115 	}
   112 
   116