From: <m_...@mv...> - 2002-05-01 17:02:13
|
# oops, I sent to rub...@ya... .. hi, all. I'm using ruby-dbi-all-0.0.13. When str is "", as_date(str) goes wrong. It returns #<DBI::Date:0x... @month=nil, @year=nil, @day=nil> There is a problem similar to it also in as_time() method. --- sql.rb.ORG Wed Apr 17 05:49:33 2002 +++ sql.rb Thu May 2 01:24:35 2002 @@ -47,8 +47,8 @@ end def as_time(str) - return nil if str.nil? t = as_timestamp(str) + return nil if t.nil? DBI::Time.new(t.hour, t.min, t.sec) end @@ -67,7 +67,7 @@ def as_date(str) - return nil if str.nil? + return nil if str.nil? or str.empty? ary = ParseDate.parsedate(str) DBI::Date.new(*ary[0,3]) rescue |