Issue Details (XML | Word | Printable)

Key: JDBC-335
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: David Smith
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

Calls to getCrossReference fail

Created: 01/Jan/14 07:57 PM   Updated: 27/Apr/14 01:41 PM
Component/s: JDBC driver
Affects Version/s: Jaybird 2.2.4
Fix Version/s: Jaybird 2.2.5, Jaybird 3.0

Time Tracking:
Not Specified

Environment: Win 8.1, JDK 1.6
Issue Links:
Relate
 


 Description  « Hide
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"





 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 02/Jan/14 05:03 PM
Caused by the changes of JDBC-331, 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 JDBC-331.

I will release 2.2.5 shortly to address this.

Mark Rotteveel added a comment - 05/Jan/14 01:05 PM
Add additional tests to Jaybird 2.2 and trunk