Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calls to getCrossReference fail [JDBC335] #381

Closed
firebird-issue-importer opened this issue Jan 1, 2014 · 6 comments
Closed

Calls to getCrossReference fail [JDBC335] #381

firebird-issue-importer opened this issue Jan 1, 2014 · 6 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Jan 1, 2014

Submitted by: David Smith (sybrix)

Is related to JDBC331

Calls to

databaseMetaData.getCrossReference(null, null, parentTable, null, null, foreignTable)

fails w/

org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 520
RDB$RELATION_CONSTRAINTS
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:138)
at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:45)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:89)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:1187)
at org.firebirdsql.jdbc.AbstractConnection.prepareMetaDataStatement(AbstractConnection.java:949)
at org.firebirdsql.jdbc.AbstractDatabaseMetaData.getStatement(AbstractDatabaseMetaData.java:6166)
at org.firebirdsql.jdbc.AbstractDatabaseMetaData.doQuery(AbstractDatabaseMetaData.java:6188)
at org.firebirdsql.jdbc.AbstractDatabaseMetaData.getCrossReference(AbstractDatabaseMetaData.java:4483)

The problem:
A space is missing before the "from" clause of the query that pulls the data.

class : org.firebirdsql.jdbc.AbstractDatabaseMetaData

private static final String GET_CROSS_KEYS = "select "
/*+" null as PKTABLE_CAT "
+" ,null as PKTABLE_SCHEM "*/
+"cast(PK.RDB$RELATION_NAME as varchar(31)) as PKTABLE_NAME"
+",cast(ISP.RDB$FIELD_NAME as varchar(31)) as PKCOLUMN_NAME"
/*+" ,null as FKTABLE_CAT "
+" ,null as FKTABLE_SCHEM "*/
+",cast(FK.RDB$RELATION_NAME as varchar(31)) as FKTABLE_NAME"
+",cast(ISF.RDB$FIELD_NAME as varchar(31)) as FKCOLUMN_NAME"
+",CAST((ISP.RDB$FIELD_POSITION + 1) as SMALLINT) as KEY_SEQ"
+",cast(RC.RDB$UPDATE_RULE as varchar(11)) as UPDATE_RULE"
+",cast(RC.RDB$DELETE_RULE as varchar(11)) as DELETE_RULE"
+",cast(PK.RDB$CONSTRAINT_NAME as varchar(31)) as PK_NAME"
+",cast(FK.RDB$CONSTRAINT_NAME as varchar(31)) as FK_NAME"
/*+" ,null as DEFERRABILITY "*/
+"from " <**************************************************************** NEEDS A SPACE BEFORE THE FROM
+"RDB$RELATION_CONSTRAINTS PK"
+",RDB$RELATION_CONSTRAINTS FK"

Commits: 5ca087d 3f8329a 51e0128 d7057b6 FirebirdSQL/fbt-repository@47647f5 FirebirdSQL/fbt-repository@abb29a6 FirebirdSQL/fbt-repository@b61ec9d FirebirdSQL/fbt-repository@262fdf0

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 2, 2014

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.5 [ 10582 ]

Fix Version: Jaybird 3.0 [ 10440 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 2, 2014

Modified by: @mrotteveel

Link: This issue is related to JDBC331 [ JDBC331 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 2, 2014

Commented by: @mrotteveel

Caused by the changes of JDBC331, I assumed that all methods changed in that issue were already covered by tests, turns out getCrossReference wasn't.

Basic fix committed, still remaining is adding additional tests and double checking the other methods changed by JDBC331.

I will release 2.2.5 shortly to address this.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 5, 2014

Commented by: @mrotteveel

Add additional tests to Jaybird 2.2 and trunk

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 5, 2014

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 27, 2014

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants