I'm working on the schema support in Jaybird, and I have a case where I
need to find an unqualified object (a table, specifically) on the search
path.
The case I have right now is for the generated keys support,
specifically to generate the RETURNING clause for
`Connection.prepareStatement(String sql, int[] columnIndex)`[1].
To be able to generate that clause (contrary to `prepareStatement(String
sql, String[] columnNames)` and `prepareStatement(String sql, int
autoGeneratedKeys)`, I need to query the system tables to get the column
names to find out which column name corresponds to which index.
If the table in the DML statement is unqualified, I need to find it
based on the current search path.
The only solution, I can come up with right now is to query
RDB$RELATIONS (or RDB$RELATION_FIELDS) by name only, and also query
RDB$GET_CONTEXT('SYSTEM', 'SEARCH_PATH') and resolve it client-side.
Is there a trick, or helper function I might be missing that could help
me identify the schema in this case?
[1]:
https://docs.oracle.com/en/java/javase/21/docs/api/java.sql/java/sql/Connection.html#prepareStatement(java.lang.String,int[])
--
Mark Rotteveel