This ticket supercedes tickets 4274 and 4605. It is a merger of testcases from both sides, with code selectively merged and some freshly written.
Ticket #4605 contained my initial patch, but it had issues of loss of precision, and abused the :limit option for precision and scale.
Ticket #4274 added seperate options for :precision and :scale, but suffered much worse from loss of precision. Also did weird casting to float/scale depending on the size of the number, which also caused precision issues.
The loss of precision issue was a major issue for me, as I wished to store high precision decimal numbers (not currency), and perform statistics on them later. The source of it was that if the numbers were ever converted to floats, they lost anything beyond 15 digits of accuracy.
This patch keeps numbers coming out of any column defined as :decimal to the BigDecimal type.
This has been tested and performs 100% on:
MySQL, PostGreSQL, SQLite2, SQLite3, DB2
It should also perform perfectly on:
SQLServer
(I don't have access to SQLServer).
I had to attack some of the other bugs that were present in existing adapters to get all of the tests to pass 100%, but fixing bugs isn't generally an issue ;-). Amongst them was the pgsql behavior of setting column defaults (no casting was performed, but it was badly needed) and the pgsql add column bug.
Outstanding issues:
I'm uncertain how to get large values into Oracle. Look at the comments in my blog here http://robbat2.livejournal.com/200033.html
Attachment coming in a moment.