On 5/3/13 2:02 AM, Max Voß wrote:
> I think I can provide you some additional information for this problem:
>
> The float to decimal conversion is not a problem per se, but seems to
> become one in the newer dabo-versions in combination with mysql. Since
> mysql stores float-values following the standards without any
> specification of the precission. (read here:
> http://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html )
>
> When I change my problematic "preis"-field from float without precission
> specification to a float(7,2) for example, dabo has no problem at all
> with the conversion.
>
> So my guess is that dabo has no, or a wrong default-value for the
> precission of float-values. But that is just a guess.
>
> After I looked into the code I am more confused then ever. I added in
> the dabo/db/dCursorMixin.py some debug output:
>
> 272 print "field_val: %s" %(_field_val)
> 273 print len(_field_val.split(".")[1])
> 274 if scale is None:
> 275 try:
> 276 scale = len(_field_val.split(".")[1])
> 277 except (IndexError, AttributeError):
> 278 scale = 2
> 279 print "_field_val: %s scale: %s" % (_field_val, sca le, )
>
> and that is what I get before the error occurs:
>
> field_val: 135.0
> 1
> _field_val: 135.0 scale: 31
> scale: 31 dec: 135.0
This is indeed baffling. Either Please put in some sanity checks:
272 print 1, self, field_val, "field_val: %s" %(_field_val)
273 print 2, self, self._field_val.split("."), len(_field_val.split(".")[1])
274 if scale is None:
275 try:
276 scale = len(_field_val.split(".")[1])
277 except (IndexError, AttributeError):
278 scale = 2
279 print 3, self, _field_val, scale, "_field_val: %s scale: %s" %
(_field_val,
scale, )
> Where the heck does the 31 come from? Why does
> len(_field_val.split(".")[1]) returns 1 before the try-catch but 31 if
> it is called in the try-catch-block.
>
> I am definitly missing something here, but perhaps you can enlighten me.
Please copy/paste the output of the above.
Also, you say nothing else changed in the code or database from 0.9.3 to 0.9.5.
I'd
like to find out the commit where the behavior changed. By any chance are you
using git?
Thanks
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]