On Feb 28, 2006, at 6:02 PM, Michael Schoen wrote:
Trying to make sure my revised oracle_adapter passes all tests, and
I'm running into an issue with test/calculations.rb.
Funny, I was struggling with the exact same problem just now with the
Sybase adapter. Glad to hear I'm not losing my noodles. (c:
In Oracle, the adapter is able to detect the datatype, and returns
back the "right" type, rather than just strings. I'm assuming that
mysql just treats these as strings?
That was my guess too. It does try to typecast the value to int, but
not the key:
def type_cast_calculated_value(value, column, operation)
operation = operation.to_s.downcase
case operation
when 'count' then value.to_i
when 'avg' then value.to_f
else column ? column.type_cast(value) : value
end
end
If somebody (Rick?) can confirm I understand the issue properly,
I'll make the unit tests pass for Oracle by hacking the tests if
the current adapter is Oracle.
Well, it's a problem for Sybase too, so it'd be nice to fix it for
all cases. Maybe by normalizing the key? I noticed that if I added
to_s in execute_grouped_calculation(), all those tests passed (but
caused two other tests to fail):
- key = associated ? key_records[row[group_alias].to_i] :
row[group_alias]
+ key = associated ? key_records[row[group_alias].to_i] :
row[group_alias].to_s
Gotta be a more delicate fix for it, tho.
John
--
John R. Sheets
http://umber.sourceforge.net
http://writersforge.sourceforge.net
_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core