*sigh* .... yes, I am coming around to this simple awareness... and there appears to be no unified decimal approach to sqlite (from what I can tell)....
On Sun, May 24, 2009 at 7:53 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > For those db that support decimal, decimal is stored as a string but > treated as double for comparison and expressions. > > If the db does not support decimal we have to make a choice: store as > string or store as double. > > If we choose to store it as a strings results involving comparisons > and expressions will be give wrong results. > > If we choose to store them as double, there may be some precisions > issues. > > > > On May 24, 7:39 pm, Yarko Tymciurak <yark...@gmail.com> wrote: > > On Sun, May 24, 2009 at 7:24 PM, Yarko Tymciurak <yark...@gmail.com> > wrote: > > > > ......... > > > > > The warning then would be that if you declare DECIMAL in DAL, it is > > > Python-Decimal, and backend storage is determined by DAL. IF you need > > > stored procedure calculations on your backend, that is (by definition) > > > backend specific, and you should then use executesql() to store and get > said > > > values, and determine the conversion which achieves best your > applications > > > design goals (performance, accuracy). > > > > To support Massimo's last comment more directly - it is not important _at > > all_ that this be stored "the same way on all db backends" - ONLY that it > > behaves the same in web2py / your python-decimal types when it is > > retrieved.... think of it as effectively no more than a "pickle" of your > > python decimal. > > > > FURTHER --- if your application does calculation BOTH here (web2py) and > > there (your db), then you have the design option to make the calculations > in > > DECIMAL on your db, and if your application is ineed demanding, it would > be > > up to you to design the desired solution for your backend: either have > > stored procedure calculations store in the appropriate > > Python-decimal-DAL-storage form, or - as appropriate for your > performance > > goals - you can make a view, and a stored procedure that would extract > your > > db's decimal into the appropriate storage form for DAL / python-decimal. > > (Clearly, string would be the simplest for these mixed comutation, high > > demand applications). > > > > > > > > > Regards, > > > - Yarko > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---