Skip to content

Commit fa95162

Browse files
committed
JDP-wip Experimental reimplementation of CallableStatement
1 parent d1bb068 commit fa95162

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

devdoc/jdp/work-in-progress/wip-experimental-reimplementation-of-callable-statement.adoc

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= work-in-progress: Experimental reimplementation of CallableStatement
22

3-
// SPDX-FileCopyrightText: Copyright 2024-2025 Mark Rotteveel
3+
// SPDX-FileCopyrightText: Copyright 2024-2026 Mark Rotteveel
44
// SPDX-License-Identifier: LicenseRef-PDL-1.0
55

66
== Status
@@ -29,8 +29,60 @@ Previous attempts to address some of these issues, uncovered other problems or c
2929

3030
== Decision
3131

32+
We'll reimplement `java.sql.CallableStatement`.
33+
This reimplementation will live next to the old implementation, and can be enabled with a connection property (see <<consequences>>) in Jaybird 7 for evaluation.
34+
In Jaybird 8, or possibly later, it'll become the default, but the old implementation can still be enabled.
35+
Eventually, the old implementation may be removed (at least one version after the new one becomes the default).
36+
37+
The exact feature set of the new implementation will be subject to further JDPs, but at least the following will be done:
38+
39+
* Only the JDBC call-escape will be transformed to selectable (`SELECT ... FROM <some-procedure>`) or executable procedure (`EXECUTE PROCEDURE <some-procedure>`).
40+
** `SELECT ... FROM <some-procedure>` will *never* be transformed to `EXECUTE PROCEDURE <some-procedure>` or `CALL <some-procedure>`.
41+
** `EXECUTE PROCEDURE <some-procedure>` will *never* be transformed to `SELECT * FROM <some-procedure>` or `CALL <some-procedure>`.
42+
** Firebird 6+ `CALL <some-procedure>` will *never* be transformed to `EXECUTE PROCEDURE <some-procedure>` nor `SELECT * FROM <some-procedure>`.
43+
* (_tentative_) Any other statement type will be executable as if it is a `PreparedStatement`.
44+
+
45+
This is tentative, as we'll need to double-check how this meshes with other requirements for `CallableStatement`.
46+
* (_tentative_) Revise stored procedure `DatabaseMetaData` information reported for input and output parameters/result set.
47+
+
48+
This will likely be subject to a further JDP.
49+
* The JDBC escape `++{?=CALL <proc> (...)}++` will only be allowed for stored procedures with a single OUT parameter, and even then use of `++{CALL <proc> (..., ?)}++` is recommended and preferred.
50+
* Mixing input and output parameters will not be supported for the JDBC call escape and `EXECUTE PROCEDURE`.
51+
+
52+
Given this is a breaking change, we will evaluate if this is the right way to go, and maybe add support for mixing in later.
53+
+
54+
** No IN/OUT mapping (treating a parameter both as input and output parameter)
55+
** No interleaving IN parameters and OUT parameters.
56+
+
57+
Either all IN comes first, followed by all OUT, except for a single output parameter executable procedures iff used with escape `++{?=CALL ...}++` (then first one OUT, then all IN).
58+
* No output parameter mapping for selectable stored procedures.
59+
60+
We recognize that some of these are breaking changes compared to the current implementation.
61+
We think this will avoid some of the complexity and hidden bugs in the current implementation, and make it more straightforward to use.
62+
However, we will evaluate during development -- and after release of the experimental version in Jaybird 7 -- if we should reintroduce some of those options.
63+
64+
[#consequences]
3265
== Consequences
3366

67+
Jaybird 7 will add a new callable statement implementation, tentatively named `FBCallableStatementV2`.
68+
The original implementation, `FBCallableStatement` will remain the default in Jaybird 7.
69+
70+
A new connection property `callableImplementation` will be added with the following values (case-insensitive):
71+
72+
[horizontal.compact]
73+
`v1`::
74+
Use original implementation, `FBCallableStatement`
75+
`v2`::
76+
Use new -- experimental -- implementation, `FBCallableStatementV2`, and other associated changes (like `DatabaseMetaData` information)
77+
78+
A system property, `org.firebirdsql.jdbc.callableImplementation` will be added to configure a global default.
79+
This will be checked at time of configuration creation.
80+
81+
* With Jaybird 7, the default is `v1`.
82+
* With Jaybird 8, the default will change to `v2`;
83+
it will then no longer be experimental
84+
* With Jaybird 9 at the earliest, `v1` will be removed.
85+
3486
[appendix]
3587
== License Notice
3688

@@ -39,7 +91,7 @@ you may only use this Documentation if you comply with the terms of this License
3991
A copy of the License is available at https://firebirdsql.org/en/public-documentation-license/.
4092

4193
The Original Documentation is "`work-in-progress: Experimental reimplementation of CallableStatement`".
42-
The Initial Writer of the Original Documentation is Mark Rotteveel, Copyright © 2024-2025.
94+
The Initial Writer of the Original Documentation is Mark Rotteveel, Copyright © 2024-2026.
4395
All Rights Reserved.
4496
(Initial Writer contact(s): mark (at) lawinegevaar (dot) nl).
4597

0 commit comments

Comments
 (0)