RDBI/rdbi-driver-mysql — Issue #4: Driver does not convert "0000-00-00 00:00:00" correctly
Author: bsanders1979
Created: 2011-10-19 03:55:04+00:00
State: open

invalid date
e:/Ruby192/lib/ruby/1.9.1/date.rb:1691:in `new_by_frags'
e:/Ruby192/lib/ruby/1.9.1/date.rb:1736:in `parse'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-driver-mysql-0.9.2/lib/rdbi/driver/mysql.rb:444:in `block i
n manipulate_type_maps'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/typelib-0.1.0/lib/typelib.rb:57:in `call'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/typelib-0.1.0/lib/typelib.rb:57:in `convert'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/typelib-0.1.0/lib/typelib.rb:15:in `execute_filterlist'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/types.rb:163:in `convert'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:382:in `block in convert_row'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:381:in `each'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:381:in `each_with_index'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:381:in `convert_row'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:353:in `block in fetch'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:352:in `each'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:352:in `fetch'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:452:in `fetch'
e:/Ruby192/lib/ruby/gems/1.9.1/gems/rdbi-0.9.1/lib/rdbi/result.rb:232:in `fetch'

Create a table with a field of type "datetime", create a record with value of "0000-00-00 00:00:00" in that field, then execute.fetch(:all, :Struct) to reproduce.

ODBC driver returns nil which seems semantically correct. But, given that MySQL accepts such a value, seems like this might be debatable.

Perhaps wrapping rdbi-driver-mysql-0.9.2/lib/rdbi/driver/mysql.rb:444 in a begin/rescue block and setting would work?