Floats being stored in database as integer?

Hi all - having a problem that’s driving me insane. I was working on a
project that required reading in Access MDB files, then writing them to
a mySQL DB. I got it working, but the DB had a bunch of worthless data
from my previous testing - so I dropped the table to start fresh. Once I
dropped it, the float values from the Access read are being written to
the DB as integers. If I print the values I have assigned just before
the write, they come up correctly as floats. However, once in the DB -
they are only 8 bytes. I am baffled… the DB schema lists the fields as
floats. Code below.

dbh.select_all(‘select * from steel’) do |row|
@record = Report.new
Report.content_columns.each do |col|
@record[col.name] = row.shift

Any advice appreciated.

An update - problem solved I think? I took a look at the development.log
file and saw the SQL statements going in w/ the float #'s correct. While
a ‘float’ type was big enough, it wasn’t working. I changed it to double
and it’s now fine. I also didn’t know schema.rb supported the double
type, but it now appears to.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs