You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: devdoc/jdp/jdp-2026-03-jdbc-escape-to-disable-escape-processing.adoc
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
= jdp-2026-03: JDBC escape disabled processing
1
+
= jdp-2026-03: JDBC escape to disable escape processing
2
2
3
3
// SPDX-FileCopyrightText: Copyright 2026 Mark Rotteveel
4
4
// SPDX-License-Identifier: LicenseRef-PDL-1.0
@@ -18,27 +18,30 @@ JDBC 4.5, to be introduced with Java 26, features a new JDBC escape which can be
18
18
For details, see also chapter 6 in https://jcp.org/aboutJava/communityprocess/maintenance/jsr221/JDBC4.5MR-November_2025.pdf[JDBC 4.5 List of proposed changes].
19
19
20
20
Unfortunately, the proposed syntax for this escape has an ambiguity, and discussion with the JDBC spec lead and others did not resolve that ambiguity.
21
-
This design proposal serves to document our interpretation of the "`escape disabled`" escape, identify the ambiguity, and document our decision how to handle it.
21
+
This design proposal serves to document our interpretation of the "`disable escape processing`" escape or "`disabled escape`" (referenced as _the escape_ in the remainder of this document), identify the ambiguity, and document our decision how to handle it.
22
22
23
-
=== The "`escape disabled`" escape
23
+
=== The "`disable escape processing`" escape
24
24
25
-
The "`escape disabled`" escape (referred to below as "`the escape`") starts with `++{\++` and ends with `++\}++`.
25
+
The escape starts with `++{\++` and ends with `++\}++`.
26
26
As a Java literal, it's `"++{\\ \\}++"`.
27
27
28
28
Within the escape:
29
29
30
30
* Other JDBC escapes are to be ignored (i.e. added to the resulting statement text without processing).
31
-
* For drivers that need it, processing/transformation of parameter placeholders (`?`) should not be performed (i.e. the question mark should remain a question mark n the resulting statement text).
32
-
* Any occurrence of `\` (backslash) that are not part of the end of the escape must be escaped by doubling, even in comments, literals and delimited identifiers.
31
+
* For drivers that need it, processing/transformation of parameter placeholders (`?`) should not be performed.
32
+
That is, the question mark should remain a question mark in the resulting statement text.
33
+
+
34
+
Jaybird doesn't need this, as processing of question marks is handled by Firebird.
35
+
* Any occurrence of `\` (backslash) that are not part of the end of the escape must be escaped by doubling, even in comments, literals, and delimited identifiers (quoted identifiers).
33
36
+
34
37
See also the examples (sometimes badly formatted) in chapter 6 of https://jcp.org/aboutJava/communityprocess/maintenance/jsr221/JDBC4.5MR-November_2025.pdf[JDBC 4.5 List of proposed changes].
35
38
36
-
The fact the backslash must be escaped everywhere inside the escape, except for the end of escape marker gives rise to the ambiguity as we see it.
39
+
The fact the backslash must be escaped everywhere inside the escape, except for the end of escape marker gives rise to an ambiguity, in our opinion.
37
40
Other JDBC escapes are not processed inside comments, literals, and identifiers.
38
41
The presence of `++\}++` ends the escape, and that -- in our opinion -- means that it's unescaped presence inside a comment, literal or delimited identifier would also end the escape.
39
42
Otherwise, it shouldn't be necessary to escape the backslash inside comments, literals. and identifiers, and the proposed change explicitly shows it must be escaped everywhere.
40
43
41
-
For example, the statement text `++{\'ends in \}literal'++`, this could be parsed in several ways:
44
+
For example, the statement text `++{\'ends in \}literal'++` could be parsed in several ways:
42
45
43
46
. Allow the escape to end inside the literal: ``'ends in literal'``
44
47
. Raise an error (e.g. "`unescaped backslash: end of escape disabled (++\}++) not allowed in literal`")
@@ -58,7 +61,7 @@ Option one seems to be the most literal interpretation of the specification, but
58
61
== Decision
59
62
60
63
We choose option two, raising an error if the escape ends within a comment, literal, or identifier.
61
-
It will be less confusing, and it prevents unexpected problems, especially with literals containing values the developer did not intend.
64
+
It will be less confusing, and it prevents unexpected problems, especially with literals containing values after processing that the developer did not intend.
62
65
63
66
The documentation in release notes and the Jaybird manual will contain a warning about the ambiguity and recommendations how to avoid it.
64
67
@@ -75,7 +78,7 @@ The contents of this Documentation are subject to the Public Documentation Licen
75
78
you may only use this Documentation if you comply with the terms of this License.
76
79
A copy of the License is available at https://firebirdsql.org/en/public-documentation-license/.
77
80
78
-
The Original Documentation is "`jdp-2026-03: JDBC escape disabled processing".
81
+
The Original Documentation is "`jdp-2026-03: JDBC escape to disable escape processing`".
0 commit comments