Skip to content

Commit 4c28f9f

Browse files
committed
[sqlite] 3.8.7 work-around for handling datetime values since it reports DATE type
... also no need to case-convert identifiers since SQLite's meta-data returns false
1 parent 5cf87ca commit 4c28f9f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import java.sql.Statement;
3838
import java.sql.DatabaseMetaData;
3939
import java.sql.Savepoint;
40+
import java.sql.Types;
4041
import java.util.ArrayList;
4142
import java.util.List;
4243

@@ -217,14 +218,10 @@ else if ( nameParts.length == 3 ) {
217218
name = nameParts[2];
218219
}
219220

220-
name = caseConvertIdentifierForJdbc(connection, name);
221-
222221
if ( schema != null ) {
223-
schema = caseConvertIdentifierForJdbc(connection, schema);
224222
// NOTE: hack to work-around SQLite JDBC ignoring schema :
225223
return new TableName(catalog, null, schema + '.' + name);
226224
}
227-
228225
return new TableName(catalog, schema, name);
229226
}
230227

@@ -239,6 +236,13 @@ protected IRubyObject jdbcToRuby(final ThreadContext context,
239236
if ( resultSet instanceof ResultSetMetaData ) {
240237
type = ((ResultSetMetaData) resultSet).getColumnType(column);
241238
}
239+
// since JDBC 3.8 there seems to be more cleverness built-in that
240+
// seems (<= 3.8.7) to get things wrong ... reports DATE SQL type
241+
// for "datetime" columns :
242+
if ( type == Types.DATE ) {
243+
// return timestampToRuby(context, runtime, resultSet, column);
244+
return stringToRuby(context, runtime, resultSet, column);
245+
}
242246
return super.jdbcToRuby(context, runtime, column, type, resultSet);
243247
}
244248

0 commit comments

Comments
 (0)