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-2025-06-schema-support.adoc
+15-3Lines changed: 15 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,11 @@ This is done -- with some exceptions -- at prepare time.
42
42
* Gbak has additional options to include/exclude (skip) schema data in backup or restore, similar to existing options to include/exclude tables
43
43
* Gstat has additional options to specify a schema for operations involving tables
44
44
* For validation, `val_sch_incl` and `val_sch_excl` (I don't think we use the equivalent,`val_tab_incl`/`val_tab_excl` in Jaybird, so might not be relevant)
45
+
* Stored procedure resolution:
46
+
** Unqualified stored procedures (`<name>`) are searched on the search path
47
+
** Qualified stored procedures (`<schema-or-package>.<name>`) are first located by schema and name, and if not found, searched on the search path by package and name.
48
+
** Scope-specified stored procedures are either only located by schema (`<schema>%SCHEMA.<name>`) or only searched on the search path by package and name (`<package>%PACKAGE.<name>`), not both.
49
+
** Fully-qualified packaged stored procedures (`<schema>.<package>.<name>`) are located by schema, package and name
45
50
46
51
JDBC defines various methods, parameters, and return values or result set columns that are related to schemas.
47
52
@@ -72,14 +77,14 @@ On Firebird 5.0 and older, this will be silently ignored.
72
77
* In internal queries in Jaybird, and fully qualified object names, we'll use the regular -- unquoted -- identifier `SYSTEM`, even though `SYSTEM` is a SQL:2023 reserved word, to preserve dialect 1 compatibility.
73
78
* `Connection.getSchema()` will return the result of `select CURRENT_SCHEMA from SYSTEM.RDB$DATABASE`;
74
79
the connection will not store this value
75
-
* `Connection.setSchema(String)` will query the current search path, if not previously called, it will prepend the schema name to the search path, otherwise it will _replace_ the previously prepended schema name.
80
+
* `Connection.setSchema(String)` will query the current search path, and if not previously called, it will prepend the schema name to the search path, otherwise it will _replace_ the previously prepended schema name.
76
81
The schema name is stored _only_ for this replacement operation (i.e. it will not be returned by `getSchema`!)
77
82
+
78
83
** The name must match exactly as is stored in the metadata (it is always case-sensitive!)
79
84
** Jaybird will take care of quoting, and will always quote on dialect 3
80
85
** Existence of the schema is **not** checked, so it is possible the current schema does not change with this operation, as `CURRENT_SCHEMA` reports the first _valid_ schema
81
86
** JDBC specifies that "`__Calling ``setSchema`` has no effect on previously created or prepared Statement objects.__`";
82
-
Jaybird cannot honour this requirement for plain `Statement`, as schema resolution is on prepare time (which for plain `Statement` is on execute), and not always for `CallableStatement` (as the implementation may delay actual prepare until execution).
87
+
Jaybird cannot honour this requirement for plain `Statement`, as schema resolution is on prepare time (which for plain `Statement` is on execute), and not always for `CallableStatement` (as the implementation may delay actual prepare until execution, though we do try to identify the procedure when the callable statement is created and use that to fully-qualify the procedure).
83
88
* Request `isc_info_sql_relation_schema` after preparing a query, record it in `FieldDescriptor`, and return it were relevant for JDBC (e.g. `ResultSetMetaData.getSchemaName(int)`)
84
89
** For Firebird 5.0 and older, we need to ensure that JDBC methods continue to report the correct value (i.e. `""` for schema-less objects)
85
90
* A Firebird 6.0 variant of the `DatabaseMetaData` and other internal metadata queries needs to be written to address at least the following things:
@@ -91,8 +96,15 @@ Jaybird cannot honour this requirement for plain `Statement`, as schema resoluti
91
96
* `FirebirdConnection`
92
97
** Added method `String getSearchPath()` to obtain the search path as reported by `RBB$GET_CONTEXT('SYSTEM', 'SEARCH_PATH')`, or `null` if schemas are not supported
93
98
** Added method `List<String> getSearchPatList()` to obtain the search path as a list of unquoted object names, or empty list if schemas are not supported
99
+
* `FBCallableStatement`
100
+
** On creating the instance, the stored procedure is parsed and identified in the database metadata, including selectability, unless `ignoreProcedureType` is `true`
101
+
*** Parsing of callable statements is changed to be able to identify schema, package and procedure, including scope specifiers
102
+
** Jaybird emulates the lookup rules as used by Firebird, and -- if found -- records the identified procedure so subsequent internal prepares refer to the same procedure, even if the search path changes;
103
+
this fulfills the JDBC requirements that a `CallableStatement` is not sensitive to current schema changes *if* Jaybird is able to identify the procedure, behaviour is undefined if the procedure was not found.
104
+
** The API of `StoredProcedureMetaData` (internal API) is changed to not report selectability, but to update the `FBProcedureCall` instance with selectability and other information, like identified schema and/or package.
105
+
** For qualified *and* unambiguous procedure reference, the selectability is cached *per connection*, for unqualified or ambiguous procedure reference, the lookup is performed on each `Connection.prepareCall`, to account for search path changes
106
+
** Support for packages was missing in the handling of callable statements, and is added, also for older versions
94
107
* TODO: Define effects for management API
95
-
* TODO: Redesign retrieval of selectable procedure information (`StoredProcedureMetaDataFactory`) to be able to find stored procedures by schema
96
108
* TODO: Add information to Jaybird manual
97
109
98
110
Note to self: use `// TODO Add schema support` in places that you identify need to get/improve schema support, while working on schema support elsewhere
Copy file name to clipboardExpand all lines: src/docs/asciidoc/release_notes.adoc
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -685,7 +685,6 @@ If you are confronted with such a change, let us know on {firebird-java}[firebir
685
685
* `FbWireOperations`
686
686
** The `ProcessAttachCallback` parameter of `authReceiveResponse` was removed, as all implementations did nothing, and since protocol 13, it wasn't only called for the attach response
687
687
** Interface `ProcessAttachCallback` was removed
688
-
* Interface `StoredProcedureMetaData` was made package-private
0 commit comments