From 4b0f0ffc0f91da0c256562458daa9fe7cf1b01da Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Tue, 14 Apr 2020 15:53:42 +0300 Subject: [PATCH] Minor modifications * Updated test case names to be more self-evident * Added exmplanatory comment to replaceEscapeSequences(). --- driver/escaping/escape_sequences.h | 4 ++++ driver/test/escape_sequences_ut.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/driver/escaping/escape_sequences.h b/driver/escaping/escape_sequences.h index e724d201f..0dc5018b1 100644 --- a/driver/escaping/escape_sequences.h +++ b/driver/escaping/escape_sequences.h @@ -2,4 +2,8 @@ #include +/** Replaces ODBC escape-sequence into a ClickHouse SQL-dialect. + * + * In case of error, input is returned as-is, with no modifications. + */ std::string replaceEscapeSequences(const std::string & query); diff --git a/driver/test/escape_sequences_ut.cpp b/driver/test/escape_sequences_ut.cpp index 65c587b33..c4157795e 100644 --- a/driver/test/escape_sequences_ut.cpp +++ b/driver/test/escape_sequences_ut.cpp @@ -37,32 +37,32 @@ TEST(EscapeSequencesCase, ParseIdent7) { "SELECT SUM(toInt64(`0 a b $ c`.abc.`0 a b $ c`))"); } -TEST(EscapeSequencesCase, ParseIdentX1) { +TEST(EscapeSequencesCase, ParseIdent_Negative1) { ASSERT_EQ(replaceEscapeSequences("SELECT SUM({fn CONVERT(0 a b $ c, SQL_BIGINT)})"), "SELECT SUM({fn CONVERT(0 a b $ c, SQL_BIGINT)})"); } -TEST(EscapeSequencesCase, ParseIdentX2) { +TEST(EscapeSequencesCase, ParseIdent_Negative2) { ASSERT_EQ(replaceEscapeSequences("SELECT SUM({fn CONVERT(.abc, SQL_BIGINT)})"), "SELECT SUM({fn CONVERT(.abc, SQL_BIGINT)})"); } -TEST(EscapeSequencesCase, ParseIdentX3) { +TEST(EscapeSequencesCase, ParseIdent_Negative3) { ASSERT_EQ(replaceEscapeSequences("SELECT SUM({fn CONVERT(.`abc`, SQL_BIGINT)})"), "SELECT SUM({fn CONVERT(.`abc`, SQL_BIGINT)})"); } -TEST(EscapeSequencesCase, ParseIdentX4) { +TEST(EscapeSequencesCase, ParseIdent_Negative4) { ASSERT_EQ(replaceEscapeSequences("SELECT SUM({fn CONVERT(abc., SQL_BIGINT)})"), "SELECT SUM({fn CONVERT(abc., SQL_BIGINT)})"); } -TEST(EscapeSequencesCase, ParseIdentX5) { +TEST(EscapeSequencesCase, ParseIdent_Negative5) { ASSERT_EQ(replaceEscapeSequences("SELECT SUM({fn CONVERT(`abc`., SQL_BIGINT)})"), "SELECT SUM({fn CONVERT(`abc`., SQL_BIGINT)})"); } -TEST(EscapeSequencesCase, ParseIdentX6) { +TEST(EscapeSequencesCase, ParseIdent_Negative6) { ASSERT_EQ(replaceEscapeSequences("SELECT SUM({fn CONVERT(abc..abc, SQL_BIGINT)})"), "SELECT SUM({fn CONVERT(abc..abc, SQL_BIGINT)})"); }