Merge pull request #6410 from yandex/more-safe-parsing-names-types-list

Slightly more safe parsing of NamesAndTypesList
This commit is contained in:
alexey-milovidov 2019-08-09 18:34:29 +03:00 committed by GitHub
commit 4e98a5b177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,16 +26,20 @@ void NamesAndTypesList::readText(ReadBuffer & buf)
size_t count;
DB::readText(count, buf);
assertString(" columns:\n", buf);
resize(count);
for (NameAndTypePair & it : *this)
String column_name;
String type_name;
for (size_t i = 0; i < count; ++i)
{
readBackQuotedStringWithSQLStyle(it.name, buf);
readBackQuotedStringWithSQLStyle(column_name, buf);
assertChar(' ', buf);
String type_name;
readString(type_name, buf);
it.type = data_type_factory.get(type_name);
assertChar('\n', buf);
emplace_back(column_name, data_type_factory.get(type_name));
}
assertEOF(buf);
}
void NamesAndTypesList::writeText(WriteBuffer & buf) const