From aee3f9a868017217f946b22b6bd8d79326e65eb2 Mon Sep 17 00:00:00 2001 From: Pavel Kartavyy Date: Tue, 8 Sep 2015 17:24:25 +0300 Subject: [PATCH] =?UTF-8?q?=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88?= =?UTF-8?q?=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88:=20add?= =?UTF-8?q?=20state=20descriptor=20to=20task=20[#METR-16142]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbms/include/DB/IO/ReadHelpers.h | 2 ++ dbms/src/IO/ReadHelpers.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/dbms/include/DB/IO/ReadHelpers.h b/dbms/include/DB/IO/ReadHelpers.h index 12302a33436..a04ebb0dc3f 100644 --- a/dbms/include/DB/IO/ReadHelpers.h +++ b/dbms/include/DB/IO/ReadHelpers.h @@ -315,6 +315,8 @@ void readDoubleQuotedString(String & s, ReadBuffer & buf); void readBackQuotedString(String & s, ReadBuffer & buf); +void readStringUntilEOF(String & s, ReadBuffer & buf); + /// в формате YYYY-MM-DD inline void readDateText(DayNum_t & date, ReadBuffer & buf) diff --git a/dbms/src/IO/ReadHelpers.cpp b/dbms/src/IO/ReadHelpers.cpp index c16d547ca9f..cea5030b422 100644 --- a/dbms/src/IO/ReadHelpers.cpp +++ b/dbms/src/IO/ReadHelpers.cpp @@ -70,6 +70,20 @@ void readString(String & s, ReadBuffer & buf) } } +void readStringUntilEOF(String & s, ReadBuffer & buf) +{ + s = ""; + while (!buf.eof()) + { + size_t bytes = buf.buffer().end() - buf.position(); + + s.append(buf.position(), bytes); + buf.position() += bytes; + + if (buf.hasPendingData()) + return; + } +} /** Позволяет найти в куске памяти следующий символ \t, \n или \\. * Функция похожа на strpbrk, но со следующими отличиями: