On Feb 25, 3:14 pm, Jason Thomas <[email protected]> wrote:
> I'm using data that I always want converted to floats not BigDecimal.
> I'm not inheriting from Sequel::Model so I can't really force the
> issue there. Is there an easy way (monkey patch) that can convert
> BigDecimal to float for every returned value?

Nope, it's going to be adapter dependent.  If you want a float instead
of a decimal value, cast your selected columns/expressions to Float:

  dataset.select(:col1.cast(Float), :col2.cast(Float))

That should work for most adapters.

To get the adapter to take something the database says is a decimal
and return a float instead requires hacking the specific adapter you
are using.  It's not usually difficult, but the above approach is
recommended instead.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to