Hi Dan,
So, is possible a new property, that inherit of Decimal, but, on save it execute to_i.to_s ? To me, the problem is that bigdecimal.to_s generates a number like 0.321512420108210029E18, mysql and sqlite3 don't know how to work with it, but to_i.to_s generates a number like 321512420108210030, and that number works. What do you think? I'm trying to do this, but without success https://gist.github.com/2361312 . Thanks 2012/4/10 Arthur M. Meskelis <[email protected]> > Hi Dan, > > First, the script's output (the same problem): > > ~ (0.000265) PRAGMA table_info("registries") > ~ (0.000091) SELECT sqlite_version(*) > ~ (0.000045) DROP TABLE IF EXISTS "registries" > ~ (0.000016) PRAGMA table_info("registries") > ~ (0.000324) CREATE TABLE "registries" ("num" DECIMAL(20, 0) NOT NULL, > PRIMARY KEY("num")) > ~ (0.000107) INSERT INTO "registries" ("num") VALUES > (0.321512420108210029E18) > 321512420108210029.0 > ~ (0.000077) SELECT "num" FROM "registries" ORDER BY "num" LIMIT 1 > 321512420108210048.0 > > I have the same problem with mysql. > I put my tests as a comment on https://gist.github.com/2346702 > > So long > Arthur > > > 2012/4/9 Dan Kubb (dkubb) <[email protected]> > > Hi Arthur, >> >> >> hi, I am having some problem here with field Decimal >> >> >> Can you try running the following script and paste the output: >> https://gist.github.com/2346702 >> >> I was able to repro it here using that script and I want to confirm it's >> the same problem you're seeing. I think it may be caused by the following >> line in the DataObjects driver: >> >> >> https://github.com/datamapper/do/blob/master/data_objects/lib/data_objects/quoting.rb#L37-39 >> >> What I'm thinking is that we need to add something to the case statement >> that returns the result of decimal.to_s('F') so that it can be handled >> properly by the underlying datastore. I haven't tested this, but that's the >> approach I'll probably test out when you respond with your results. >> >> -- >> >> Dan >> >> -- >> You received this message because you are subscribed to the Google Groups >> "DataMapper" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/datamapper/-/0poxwET3fykJ. >> >> 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/datamapper?hl=en. >> > > > > -- > ------------------------------------------ > 1. Notebook para você ficar livre e programar a vontade: R$ 2300 > 2. Curso de Programação/SysAdmin/DBA: R$ 5000 > 3. Pedir a solução pronta para um problema numa lista de discussão: Não > tem preço ! > > E para todas as outras existe RTFM, STFW e LMGTFY > -- ------------------------------------------ 1. Notebook para você ficar livre e programar a vontade: R$ 2300 2. Curso de Programação/SysAdmin/DBA: R$ 5000 3. Pedir a solução pronta para um problema numa lista de discussão: Não tem preço ! E para todas as outras existe RTFM, STFW e LMGTFY -- You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en.
