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)})"); }