RDBI/rdbi-driver-mysql — Issue #8: datetime insertion fails
Author: pbennett
Created: 2011-12-13 15:21:34+00:00
State: open

With Ruby 1.9.2 [or 1.9.3], selecting a datetime value from a datetime column from one table and then trying to insert the exact same fetched value (from a result row) into a table with the same column and type fails with:
d:/ruby/lib/ruby/gems/1.9.1/gems/rdbi-driver-mysql-0.9.2/lib/rdbi/driver/mys
ql.rb:408:in `execute': Incorrect datetime value: '2006-02-09 18:07:27 -0500' for column 'created_at' at row 1
(Mysql::Error)

ie:
rows = db.execute("select * from xxxx where yyy=?, ...", vala, valb).fetch(:all, :Struct)
rows.each do |row|
db.execute("insert into yyy (col_a, col_b, ...) values (?, ?, ?, ...)", row.col_a, row.col_b, xxxx, yyy, ...)
...
end