Permalink
Browse files

[postgres] support BIT(n) type where n > 1 as "bit strings"

  • Loading branch information...
1 parent b78fc5f commit 9c0d7c403ff5ad7afa10d503dcdf719d25d4a528 @kares kares committed Mar 21, 2013
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java
@@ -88,6 +88,13 @@ protected IRubyObject jdbcToRuby(final Ruby runtime,
switch ( type ) {
case Types.TIMESTAMP:
return stringToRuby(runtime, resultSet, resultSet.getString(column));
+ case Types.BIT:
+ // we do get BIT for 't' 'f' as well as BIT strings e.g. "0110" :
+ final String bits = resultSet.getString(column);
+ if ( bits == null || bits.length() > 1 ) {
+ return stringToRuby(runtime, resultSet, bits);
+ }
+ return booleanToRuby(runtime, resultSet, resultSet.getBoolean(column));
//case Types.JAVA_OBJECT: case Types.OTHER:
//return objectToRuby(runtime, resultSet, resultSet.getObject(column));
case Types.ARRAY:

0 comments on commit 9c0d7c4

Please sign in to comment.