Heredoc updated tests

This commit is contained in:
Maksim Kita 2021-07-25 22:01:25 +03:00
parent 22fa1efacb
commit 197bda1ff1
7 changed files with 25 additions and 2 deletions

View File

@ -28,7 +28,7 @@ inline UInt64 ALWAYS_INLINE normalizedQueryHash(const char * begin, const char *
continue; continue;
/// Literals. /// Literals.
if (token.type == TokenType::Number || token.type == TokenType::StringLiteral) if (token.type == TokenType::Number || token.type == TokenType::StringLiteral || token.type == TokenType::HereDoc)
{ {
if (0 == num_literals_in_sequence) if (0 == num_literals_in_sequence)
hash.update("\x00", 1); hash.update("\x00", 1);
@ -156,7 +156,7 @@ inline void ALWAYS_INLINE normalizeQueryToPODArray(const char * begin, const cha
prev_insignificant = false; prev_insignificant = false;
/// Literals. /// Literals.
if (token.type == TokenType::Number || token.type == TokenType::StringLiteral) if (token.type == TokenType::Number || token.type == TokenType::StringLiteral || token.type == TokenType::HereDoc)
{ {
if (0 == num_literals_in_sequence) if (0 == num_literals_in_sequence)
res_data.push_back('?'); res_data.push_back('?');

View File

@ -20,3 +20,6 @@ SELECT ? AS xyz11
SELECT ? xyz11 SELECT ? xyz11
SELECT ?, xyz11 SELECT ?, xyz11
SELECT ?.. SELECT ?..
SELECT ? xyz11
SELECT ?, xyz11
SELECT ?..

View File

@ -20,3 +20,7 @@ SELECT normalizeQuery('SELECT 1 AS xyz11');
SELECT normalizeQuery('SELECT 1 xyz11'); SELECT normalizeQuery('SELECT 1 xyz11');
SELECT normalizeQuery('SELECT 1, xyz11'); SELECT normalizeQuery('SELECT 1, xyz11');
SELECT normalizeQuery('SELECT 1, ''xyz11'''); SELECT normalizeQuery('SELECT 1, ''xyz11''');
SELECT normalizeQuery('SELECT $doc$VALUE$doc$ xyz11');
SELECT normalizeQuery('SELECT $doc$VALUE$doc$, xyz11');
SELECT normalizeQuery('SELECT $doc$VALUE$doc$, ''xyz11''');

View File

@ -5,3 +5,5 @@
1 1
1 1
1 1
1
1

View File

@ -5,3 +5,7 @@ SELECT normalizedQueryHash('[1, 2, 3]') = normalizedQueryHash('[1, ''x'']');
SELECT normalizedQueryHash('[1, 2, 3, x]') != normalizedQueryHash('[1, x]'); SELECT normalizedQueryHash('[1, 2, 3, x]') != normalizedQueryHash('[1, x]');
SELECT normalizedQueryHash('SELECT 1 AS `xyz`') != normalizedQueryHash('SELECT 1 AS `abc`'); SELECT normalizedQueryHash('SELECT 1 AS `xyz`') != normalizedQueryHash('SELECT 1 AS `abc`');
SELECT normalizedQueryHash('SELECT 1 AS xyz111') = normalizedQueryHash('SELECT 2 AS xyz234'); SELECT normalizedQueryHash('SELECT 1 AS xyz111') = normalizedQueryHash('SELECT 2 AS xyz234');
SELECT normalizedQueryHash('SELECT $doc$VALUE$doc$ AS `xyz`') != normalizedQueryHash('SELECT $doc$VALUE$doc$ AS `abc`');
SELECT normalizedQueryHash('SELECT $doc$VALUE$doc$ AS xyz111') = normalizedQueryHash('SELECT $doc$VALUE$doc$ AS xyz234');

View File

@ -9,3 +9,5 @@ $do$ $ doc$ $doc $ $doco$ $do$ $ doc$ $doc $ $doco$
该类型的引擎 该类型的引擎
VALUE VALUE
VALUE VALUE
\nvalue1\nvalue2\nvalue3\n
\'\\xc3\\x28\'

View File

@ -11,3 +11,11 @@ SELECT $doc$该类型的引擎$doc$;
SELECT $РАЗДЕЛИТЕЛЬ$VALUE$РАЗДЕЛИТЕЛЬ$; SELECT $РАЗДЕЛИТЕЛЬ$VALUE$РАЗДЕЛИТЕЛЬ$;
SELECT $$VALUE$$; SELECT $$VALUE$$;
SELECT $$
value1
value2
value3
$$;
SELECT $doc$'\xc3\x28'$doc$;