Permalink
Browse files

fix MySQL Java API regression while refactoring jdbcToRuby

  • Loading branch information...
1 parent 04778a8 commit bcb646c9daed2f6169ff616ffcac022798ff6968 @kares kares committed Apr 3, 2013
Binary file not shown.
@@ -32,7 +32,6 @@
import java.sql.SQLException;
import java.sql.Types;
import java.util.List;
-import java.util.ArrayList;
import org.jcodings.specific.UTF8Encoding;
@@ -73,7 +73,8 @@ protected IRubyObject unmarshalKeysOrUpdateCount(final ThreadContext context,
protected IRubyObject jdbcToRuby(Ruby runtime, int column, int type, ResultSet resultSet)
throws SQLException {
if ( Types.BOOLEAN == type || Types.BIT == type ) {
- return integerToRuby(runtime, resultSet, resultSet.getBoolean(column) ? 1 : 0);
+ final boolean value = resultSet.getBoolean(column);
+ return resultSet.wasNull() ? runtime.getNil() : runtime.newFixnum(value ? 1 : 0);
}
return super.jdbcToRuby(runtime, column, type, resultSet);
}

0 comments on commit bcb646c

Please sign in to comment.