Hello, For some reasons I had troubles installing tiny_tds on my development machine (windows7 32 bit), so I gave pretty early and remained with the old odbc adapter.
the typecast_on_load plugin worked flawlessly, however. Since only 'money' fields are not typecast by the adapter, and I have just a handful of these, this solution seems perfect for me. thank you Giovanni On 2 December 2013 13:42, Giovanni Gervasio <[email protected]>wrote: > thank you, i am using the odbc adapter. will look into the plugin you > mention > > > On Monday, December 2, 2013, Jeremy Evans wrote: > >> On Monday, December 2, 2013 12:23:34 AM UTC-8, Giovanni Gervasio wrote: >> >>> Sorry if this is a trivial question. >>> >>> I have a table in SQL server thus: >>> >>> CREATE TABLE widgets >>> ( >>> id INT Identity(1, 1) PRIMARY KEY, >>> name VARCHAR(12), >>> cost MONEY >>> ) >>> >>> SELECT * FROM widgets >>> >>> id name cost >>> ----------- ------------ --------------------- >>> 1 compass 74.9900 >>> 2 hat 49.9900 >>> 3 book 19.9900 >>> >>> >>> and a Widget class >>> >>> class Widget < Sequel::Model >>> end >>> >>> Contrary to my expectations, Widget.cost has class String'. >>> >>> Widget[1].cost + Widget[2].cost >>> => "74.990049.9900" >>> >>> To perform any arithmetics I have to convert 'cost' explicitly to a >>> numeric type. I am sure that there is a way to have the model store and >>> return a BigDecimal, or another numeric type, but I could not find it. >>> >> >> Which adapter are you using? If you are using the tinytds adapter, >> Sequel relies on tiny_tds to do the conversion, so in that case you need to >> talk to the tiny_tds developers. >> >> For models, you may be able to work around this using the >> typecast_on_load plugin. >> >> Thanks, >> Jeremy >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "sequel-talk" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/sequel-talk/iGGc3hqIo3E/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sequel-talk. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
