mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
███████████, ssqls: fixed error [#CONV-3961].
This commit is contained in:
parent
05fb543e90
commit
cbd54871ea
@ -352,6 +352,7 @@ inline void readDateTimeText(mysqlxx::DateTime & datetime, ReadBuffer & buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Общие методы для чтения значения в текстовом виде из tab-separated формата.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void readText(T & x, ReadBuffer & buf)
|
void readText(T & x, ReadBuffer & buf)
|
||||||
{
|
{
|
||||||
@ -376,6 +377,42 @@ template <> inline void readText<mysqlxx::Date> (mysqlxx::Date & x, ReadBuff
|
|||||||
template <> inline void readText<mysqlxx::DateTime> (mysqlxx::DateTime & x, ReadBuffer & buf) { readDateTimeText(x, buf); }
|
template <> inline void readText<mysqlxx::DateTime> (mysqlxx::DateTime & x, ReadBuffer & buf) { readDateTimeText(x, buf); }
|
||||||
|
|
||||||
|
|
||||||
|
/// Общие методы для чтения значения в текстовом виде, при необходимости, в кавычках.
|
||||||
|
template <typename T>
|
||||||
|
void readQuoted(T & x, ReadBuffer & buf)
|
||||||
|
{
|
||||||
|
/// Переношу ошибку в рантайм, так как метод требуется для компиляции DBObject-ов
|
||||||
|
throw Exception("Method readQuoted is not implemented for this type.", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> inline void readQuoted<UInt8> (UInt8 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<UInt16> (UInt16 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<UInt32> (UInt32 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<UInt64> (UInt64 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<Int8> (Int8 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<Int16> (Int16 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<Int32> (Int32 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<Int64> (Int64 & x, ReadBuffer & buf) { readIntText(x, buf); }
|
||||||
|
template <> inline void readQuoted<Float32> (Float32 & x, ReadBuffer & buf) { readFloatText(x, buf); }
|
||||||
|
template <> inline void readQuoted<Float64> (Float64 & x, ReadBuffer & buf) { readFloatText(x, buf); }
|
||||||
|
template <> inline void readQuoted<String> (String & x, ReadBuffer & buf) { readQuotedString(x, buf); }
|
||||||
|
template <> inline void readQuoted<bool> (bool & x, ReadBuffer & buf) { readBoolText(x, buf); }
|
||||||
|
|
||||||
|
template <> inline void readQuoted<mysqlxx::Date> (mysqlxx::Date & x, ReadBuffer & buf)
|
||||||
|
{
|
||||||
|
assertString("'", buf);
|
||||||
|
readDateText(x, buf);
|
||||||
|
assertString("'", buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> inline void readQuoted<mysqlxx::DateTime> (mysqlxx::DateTime & x, ReadBuffer & buf)
|
||||||
|
{
|
||||||
|
assertString("'", buf);
|
||||||
|
readDateTimeText(x, buf);
|
||||||
|
assertString("'", buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Пропустить пробельные символы.
|
/// Пропустить пробельные символы.
|
||||||
inline void skipWhitespaceIfAny(ReadBuffer & buf)
|
inline void skipWhitespaceIfAny(ReadBuffer & buf)
|
||||||
{
|
{
|
||||||
|
@ -353,6 +353,7 @@ inline void writeEscapedRow(const mysqlxx::Row & row, WriteBuffer & buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Общие методы для вывода значения в текстовом виде для tab-separated формата.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void writeText(const T & x, WriteBuffer & buf)
|
void writeText(const T & x, WriteBuffer & buf)
|
||||||
{
|
{
|
||||||
@ -377,4 +378,40 @@ template <> inline void writeText<mysqlxx::Date> (const mysqlxx::Date & x, Wri
|
|||||||
template <> inline void writeText<mysqlxx::DateTime> (const mysqlxx::DateTime & x, WriteBuffer & buf) { writeDateTimeText(x, buf); }
|
template <> inline void writeText<mysqlxx::DateTime> (const mysqlxx::DateTime & x, WriteBuffer & buf) { writeDateTimeText(x, buf); }
|
||||||
|
|
||||||
|
|
||||||
|
/// Общие методы для вывода значения в текстовом виде, при необходимости, в кавычках.
|
||||||
|
template <typename T>
|
||||||
|
void writeQuoted(const T & x, WriteBuffer & buf)
|
||||||
|
{
|
||||||
|
/// Переношу ошибку в рантайм, так как метод требуется для компиляции DBObject-ов
|
||||||
|
throw Exception("Method writeQuoted is not implemented for this type.", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> inline void writeQuoted<UInt8> (const UInt8 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<UInt16> (const UInt16 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<UInt32> (const UInt32 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<UInt64> (const UInt64 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<Int8> (const Int8 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<Int16> (const Int16 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<Int32> (const Int32 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<Int64> (const Int64 & x, WriteBuffer & buf) { writeIntText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<Float32> (const Float32 & x, WriteBuffer & buf) { writeFloatText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<Float64> (const Float64 & x, WriteBuffer & buf) { writeFloatText(x, buf); }
|
||||||
|
template <> inline void writeQuoted<String> (const String & x, WriteBuffer & buf) { writeQuotedString(x, buf); }
|
||||||
|
template <> inline void writeQuoted<bool> (const bool & x, WriteBuffer & buf) { writeBoolText(x, buf); }
|
||||||
|
|
||||||
|
template <> inline void writeQuoted<mysqlxx::Date> (const mysqlxx::Date & x, WriteBuffer & buf)
|
||||||
|
{
|
||||||
|
writeChar('\'', buf);
|
||||||
|
writeDateText(x, buf);
|
||||||
|
writeChar('\'', buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> inline void writeQuoted<mysqlxx::DateTime> (const mysqlxx::DateTime & x, WriteBuffer & buf)
|
||||||
|
{
|
||||||
|
writeChar('\'', buf);
|
||||||
|
writeDateTimeText(x, buf);
|
||||||
|
writeChar('\'', buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user