From f053c3394c57fd57a7d5ebd55e2d607dee6b22dc Mon Sep 17 00:00:00 2001 From: Dias <110160920+diasdauletov@users.noreply.github.com> Date: Wed, 9 Aug 2023 11:41:43 +0200 Subject: [PATCH] Include multiline string literals when creating statements (#1520) * Include multiline string literals when creating statements * Bump version to 2.6.2 --- core/compilers.ts | 1 + tests/core/core.spec.ts | 8 ++++++++ tests/core/strings-act-literally.js.test | 8 ++++++++ version.bzl | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/compilers.ts b/core/compilers.ts index 19f0ac1c0..d076bd4a0 100644 --- a/core/compilers.ts +++ b/core/compilers.ts @@ -209,6 +209,7 @@ function extractSqlxParts(rootNode: SyntaxTreeNode) { SyntaxTreeNodeType.JAVASCRIPT_TEMPLATE_STRING_PLACEHOLDER, SyntaxTreeNodeType.SQL_COMMENT, SyntaxTreeNodeType.SQL_LITERAL_STRING, + SyntaxTreeNodeType.SQL_LITERAL_MULTILINE_STRING, SyntaxTreeNodeType.SQL_STATEMENT_SEPARATOR ].includes(node.type) ) diff --git a/tests/core/core.spec.ts b/tests/core/core.spec.ts index 9254475a3..1be9bb952 100644 --- a/tests/core/core.spec.ts +++ b/tests/core/core.spec.ts @@ -1319,11 +1319,19 @@ pre_operations { compilers.compile( ` select + """ + triple + quotes + """, "asd\\"123'def", 'asd\\'123"def', post_operations { select + """ + triple + quotes + """, "asd\\"123'def", 'asd\\'123"def', } diff --git a/tests/core/strings-act-literally.js.test b/tests/core/strings-act-literally.js.test index b79eee893..49678f3d3 100644 --- a/tests/core/strings-act-literally.js.test +++ b/tests/core/strings-act-literally.js.test @@ -17,6 +17,10 @@ const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select + """ + triple + quotes + """, "asd\\"123'def", 'asd\\'123"def', @@ -37,6 +41,10 @@ const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select + """ + triple + quotes + """, "asd\\"123'def", 'asd\\'123"def', `]; diff --git a/version.bzl b/version.bzl index b326fc72f..f51d6f28e 100644 --- a/version.bzl +++ b/version.bzl @@ -1,3 +1,3 @@ # NOTE: If you change the format of this line, you must change the bash command # in /scripts/publish to extract the version string correctly. -DF_VERSION = "2.6.1" +DF_VERSION = "2.6.2"