Hello,
I've been working on an abstraction layer which sits on top of ruby-dbi
that tries to hide the differences of MySQL vs. Postgres. In so doing,
I noticed that the various DBD drivers don't coerce column values
consistently.
For example, mysql does no coercing of column values, but Postgres
coerces integers to Ruby Fixnums, boolean columns to
TrueClass/FalseClass objects, time/datetime to DBI::Time objects, etc.
MySQL has no boolean column type, but the others would map nicely. Is
this issue just waiting for a patch?
I also noticed that the default values available through
DatabaseHandle#columns are not coerced. For example, if you select a
boolean column from a postgres table, you get back either TrueClass or
FalseClass objects. But if you examine the default value in
DatabaseHandle#columns(), you might see a 't', or 'f'.
Thanks,
-Brad
|