-
Notifications
You must be signed in to change notification settings - Fork 619
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
sqlite-jdbc does not comply with JDBC Specification regarding Appendix B.1, B.2, & B.3 #933
Comments
from what i recall when i looked into this, it's because the first one is looking at the table definition, while the second one is looking at the actual value for that row. There is no guarantee that they will match, since SQLite doesn't enforce types. So you can define a column as 'datetime', and store a float inside. |
@gotson That’s a separate issue re no type-safety. In this case what I am saying is if a column is typed as |
- added ValueAccessor SPI and default implementations, replaces TypeMap as a more effective means of resolving Java types corresponding with JDBC types, getting query result values, and setting parameter values - added schema information for database product name and version to special case sqlite's type-safety issues xerial/sqlite-jdbc#928 xerial/sqlite-jdbc#933
Could you provide a unit test showing the behaviour you think is wrong ? |
I don't have time to write unit tests for sqlite. Here again from the OP is a complete description and example:
|
If you don't, why would we? You're just throwing issues without much details or repro, then you are saying you don't have any time to invest in this. |
There is plenty enough detail here for a “maintainer” to grok. If you aren’t interested in fixing stuff here, you might consider a different hobby. |
TLDR: Column values obtained from
getObject
should match the types fromgetColumnType(int)
, but they often do not.Referring to JDBC 4.x Specification. (Same mappings exist in JDBC 3 Specification)
According to the spec:
The problem is calls to
ResultSetMetadata#getColumnType(int)
don't align with calls toResultSet#getObject(int)
. Generally, Sqlite's implementation ofgetObject(int)
does not adhere to Table B.3.For instance, if I call
getColumnType(int)
and get backTypes.DATE
, the JDBC specification states that I can expect values of typejava.sql.Date
for that column. However, if I callgetObject(int)
for a row including that column, sqlite returns a value of typejava.lang.String
.Similarly, calls to
getColumn(int, Class<?>)
are not covered. IfgetColumnType(int)
returnsTypes.CLOB
andgetObject(int, Class<?>)
is called withjava.sql.Clob
for the same column, aSQLFeatureNotSupportedException("not implemented by SQLite JDBC driver")
results becausegetColumn(int, Class<?>)
does not handlejava.sql.Clob
.This behavior does not appear to comply with the specification (both 3 & 4), but more importantly this behavior complicates writing type-safe code generators that work with sqlite db connections.
The text was updated successfully, but these errors were encountered: