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

Change metadata queries to always return VARCHAR for strings [JDBC308] #354

Closed
firebird-issue-importer opened this issue Apr 27, 2013 · 6 comments

Comments

@firebird-issue-importer

Submitted by: @mrotteveel

Jira_subtask_outward JDBC310

Change metadata queries to always return VARCHAR for strings. Some columns in the metadata are currently declared as CHAR instead of VARCHAR, this can cause problems, see http://youtrack.jetbrains.com/issue/IDEA-100786 for an example.

The weird thing is that when checking the metadata with a simple program, the returned string is of the actual length and not of the declared CHAR(31) length

Commits: b69af05 f645829 1b58474 FirebirdSQL/fbt-repository@58f0886 FirebirdSQL/fbt-repository@700abcc FirebirdSQL/fbt-repository@a867b8d

@firebird-issue-importer
Copy link
Author

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

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.3 [ 10510 ]

Fix Version: Jaybird 2.3 [ 10440 ]

@firebird-issue-importer
Copy link
Author

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

Commented by: @mrotteveel

Changed all queries to use VARCHARs, I am leaving this open for now to see if I can find the cause for the difference in behaviour described in the IntelliJ IDEA ticket.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 8, 2013

Commented by: @mrotteveel

As described in the ticket with Jetbrains, Jaybird would only trim the strings for metadata ResultSets if the getString() method was called, IntelliJ only calls getString() for Types.VARCHAR, but the columnType was Types.CHAR so getObject() was called and the string wasn't trimmed.

I am considering a solution where I replace the current metadata boolean in ResultSet with using a separate ResultSet subclass for metadata and/or using a StringField subclass/wrapper for metadata that will take care of trimming. This might also make for a 'prettier' solution than all those CAST(... AS VARCHAR(31)) in a large number of queries (and it might increase forward compatibility if identifiers can become larger in future versions).

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 8, 2013

Commented by: @mrotteveel

Created 'subtask' for a better solution. I will do some additional testing in IntelliJ before closing this ticket.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 11, 2013

Modified by: @mrotteveel

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

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 11, 2013

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