mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-24 02:30:51 +00:00
Merge pull request #6410 from yandex/more-safe-parsing-names-types-list
Slightly more safe parsing of NamesAndTypesList
This commit is contained in:
commit
4e98a5b177
@ -26,16 +26,20 @@ void NamesAndTypesList::readText(ReadBuffer & buf)
|
|||||||
size_t count;
|
size_t count;
|
||||||
DB::readText(count, buf);
|
DB::readText(count, buf);
|
||||||
assertString(" columns:\n", 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);
|
assertChar(' ', buf);
|
||||||
String type_name;
|
|
||||||
readString(type_name, buf);
|
readString(type_name, buf);
|
||||||
it.type = data_type_factory.get(type_name);
|
|
||||||
assertChar('\n', buf);
|
assertChar('\n', buf);
|
||||||
|
|
||||||
|
emplace_back(column_name, data_type_factory.get(type_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertEOF(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NamesAndTypesList::writeText(WriteBuffer & buf) const
|
void NamesAndTypesList::writeText(WriteBuffer & buf) const
|
||||||
|
Loading…
Reference in New Issue
Block a user