src/StreamRelationalReader.h
branchv_0
changeset 22 e81019af67dc
parent 21 abd3e7f26584
child 24 6f7acc3b274c
equal deleted inserted replaced
21:abd3e7f26584 22:e81019af67dc
    48 	/**
    48 	/**
    49 	 * types of columns in the current table
    49 	 * types of columns in the current table
    50 	 */
    50 	 */
    51 	std::vector<TypeId> columnTypes;
    51 	std::vector<TypeId> columnTypes;
    52 	std::vector<string_t> columnNames;
    52 	std::vector<string_t> columnNames;
    53 	std::vector<std::pair<string_t, TypeId>> columns;
    53 	std::vector<handlers::AttributeMetadata> columns;
    54 
    54 
    55 	/**
    55 	/**
    56 	 * TODO: remove?
    56 	 * TODO: remove?
    57 	 */
    57 	 */
    58 	string_t readString(std::istream &input, const TypeId typeId) {
    58 	string_t readString(std::istream &input, const TypeId typeId) {
   153 				// Read column types
   153 				// Read column types
   154 				for (int i = 0; i < columnCount; i++) {
   154 				for (int i = 0; i < columnCount; i++) {
   155 					TypeId typeId = (TypeId) integerReader.readValue(input); // TODO: přetypování OK?
   155 					TypeId typeId = (TypeId) integerReader.readValue(input); // TODO: přetypování OK?
   156 					string_t typeCode = toTypeCode(typeId); // validate typeId TODO: je potřeba?
   156 					string_t typeCode = toTypeCode(typeId); // validate typeId TODO: je potřeba?
   157 					columnTypes[i] = typeId;
   157 					columnTypes[i] = typeId;
   158 				}
       
   159 
   158 
   160 				for (int i = 0; i < columnCount; i++) {
   159 					// put together names, type ids and type codes:
   161 					columns[i] = {columnNames[i], columnTypes[i]};
   160 					columns[i] = {columnNames[i], columnTypes[i], typeCode};
   162 				}
   161 				}
   163 
   162 
   164 				for (StringHandler* handler : stringHandlers) handler->startRelation(tableName, columns);
   163 				for (StringHandler* handler : stringHandlers) handler->startRelation(tableName, columns);
   165 				for (ValuesHandler* handler : valuesHandlers) handler->startRelation(tableName, columns);
   164 				for (ValuesHandler* handler : valuesHandlers) handler->startRelation(tableName, columns);
   166 
   165