Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
[do_hdqldb,do_mysql,do_oracle,do_postgres,do_sqlite3] Added support f…
Browse files Browse the repository at this point in the history
…or subclasses of supported types - p.2
  • Loading branch information
Piotr Gega (pietia) committed Nov 14, 2009
1 parent 59923d1 commit 441ecd5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
Expand Up @@ -40,11 +40,8 @@ public HsqldbDriverDefinition() {
@Override
public void setPreparedStatementParam(PreparedStatement ps,
IRubyObject arg, int idx) throws SQLException {
switch (RubyType.getRubyType(arg.getType().getName())) {
switch (RubyType.inferRubyType(arg)) {
case NIL:
// XXX ps.getParameterMetaData().getParameterType(idx) produces
// com.mysql.jdbc.ResultSetMetaData:397:in `getField': java.lang.NullPointerException
// from com.mysql.jdbc.ResultSetMetaData:275:in `getColumnType'
ps.setNull(idx, Types.NULL);
break;
default:
Expand Down
Expand Up @@ -67,7 +67,7 @@ public IRubyObject getTypecastResultSetValue(Ruby runtime,
@Override
public void setPreparedStatementParam(PreparedStatement ps,
IRubyObject arg, int idx) throws SQLException {
switch (RubyType.getRubyType(arg.getType().getName())) {
switch (RubyType.inferRubyType(arg)) {
case NIL:
// XXX ps.getParameterMetaData().getParameterType(idx) produces
// com.mysql.jdbc.ResultSetMetaData:397:in `getField': java.lang.NullPointerException
Expand Down
Expand Up @@ -131,11 +131,8 @@ public IRubyObject getTypecastResultSetValue(Ruby runtime,
@Override
public void setPreparedStatementParam(PreparedStatement ps,
IRubyObject arg, int idx) throws SQLException {
switch (RubyType.getRubyType(arg.getType().getName())) {
switch (RubyType.inferRubyType(arg)) {
case NIL:
// XXX ps.getParameterMetaData().getParameterType(idx) produces
// com.mysql.jdbc.ResultSetMetaData:397:in `getField': java.lang.NullPointerException
// from com.mysql.jdbc.ResultSetMetaData:275:in `getColumnType'
ps.setNull(idx, Types.NULL);
break;
default:
Expand Down
Expand Up @@ -75,7 +75,7 @@ public Properties getDefaultConnectionProperties() {
public void setPreparedStatementParam(PreparedStatement ps,
IRubyObject arg, int idx) throws SQLException {
int jdbcType;
switch (RubyType.getRubyType(arg.getType().getName())) {
switch (RubyType.inferRubyType(arg)) {
case STRING:
jdbcType = ps.getParameterMetaData().getParameterType(idx);
switch (jdbcType) {
Expand Down
Expand Up @@ -160,7 +160,7 @@ public IRubyObject getTypecastResultSetValue(Ruby runtime,
@Override
public void setPreparedStatementParam(PreparedStatement ps,
IRubyObject arg, int idx) throws SQLException {
switch (RubyType.getRubyType(arg.getType().getName())) {
switch (RubyType.inferRubyType(arg)) {
case BIG_DECIMAL:
ps.setString(idx, ((RubyBigDecimal) arg).toString());
break;
Expand Down

0 comments on commit 441ecd5

Please sign in to comment.