Bugs item #9106, was opened at 2007-03-07 10:55
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=9106&group_id=2014

Category: AR-JDBC
Group: None
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Julien Faissolle (jfe)
Assigned to: Nobody (None)
Summary: NoMethodError for NUMERIC and DECIMAL columns with a NULL value

Initial Comment:
A column value of NULL for a numeric or decimal type causes a NoMethodError. 
This  seems to come from the following code in method convert_jdbc_type_to_ruby 
(jdbc_adapter.rb):

   resultset.getBigDecimal(row).toString

If getBigDecimal returns nil, an exception is thrown.

----------------------------------------------------------------------

>Comment By: Ola Bini (olabini)
Date: 2007-08-11 15:22

Message:
This is not applicable anymore, due to large changes in the code base.

----------------------------------------------------------------------

Comment By: Martin Plöger (martin_ploeger)
Date: 2007-03-13 12:29

Message:
Okay, actually I CAN'T LOAD Objects, I can create them

My_Class.find :all :conditions => "name = 'hugo'"
results in an empty Array [] although there is a matching row in the table

----------------------------------------------------------------------

Comment By: Martin Plöger (martin_ploeger)
Date: 2007-03-13 12:19

Message:
I've got the same Problem after I patched ActiveRecord for Oracle like posted 
in Bug [#9107] With Oracle Driver: unable to choose type for decimal

http://rubyforge.org/tracker/index.php?func=detail&aid=9107&group_id=2014&atid=7857

I patched it that way (for decimal, numeric and bigint): 
BigDecimal.new(resultset.getBigDecimal(row) ? 
resultset.getBigDecimal(row).toString : "0")

ugly, but seems to work. Now I can load Objects, but I can't store them:

irb(main):031:0> r.save
ActiveRecord::StatementInvalid: RuntimeError: jdbc_adapter: type  not supported
yet: INSERT INTO ruby_tests (name, id) VALUES('hugo', 99)
        from C:/UserProg/011100/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2
/lib/active_record/connection_adapters/abstract_adapter.rb:128:in `log'
        from C:/UserProg/011100/jRuby/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0
.2.3/lib/jdbc_adapter/jdbc_oracle.rb:70:in `insert'
        from C:/UserProg/011100/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2
/lib/active_record/base.rb:1819:in `create'
        from C:/UserProg/011100/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2
/lib/active_record/callbacks.rb:254:in `create'
        from C:/UserProg/011100/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2
/lib/active_record/timestamp.rb:39:in `create_with_timestamps'
        from C:/UserProg/011100/jRuby/lib/ruby/gems/1.8/gems/activerecord-1.15.2

The generated SQL-Statement is valid, when executed to oracle, but something 
else doesn't seem to work, maybe the logger or the execute-command itself?


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=9106&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to