[dabo-users] Problem with custom sql-statement and getDataSet() with version>0.9.3

Author: Max Voß

Posted: 2013-04-30 at 10:03:51

Hello,

I am trying to update dabo from version 0.9.3 to a newer one, currently

0.9.9 but 0.9.5 doesn't work neither.

The code that worked fine in version 0.9.3 and now creates the error is

the following:

tmpCursor = self.Form.PrimaryBizobj.getTempCursor()

tmpCursor.execute("SELECT rechnung_position.name, preis, anzahl FROM

rechnung INNER JOIN rechnung_position ON rechnung.id=rechnung_id WHERE

re chnung.id=%i ORDER BY position" %

(self.Form.getBizobj("rechnung").getPK()))

ds_artikel = tmpCursor.getDataSet()

Here the complete error:

Traceback (most recent call last):

File

"/home/max/projekte/kolibrill/dabo/dabo/ui/uiwx/dControlMixin.py", line

27, in _onWxHit

self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)

File "/home/max/projekte/kolibrill/dabo/dabo/ui/uiwx/dPemMixin.py",

line 1074, in raiseEvent

super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,

**kwargs)

File "/home/max/projekte/kolibrill/dabo/dabo/lib/eventMixin.py", line

81, in raiseEvent

bindingFunction(event)

File "/tmp/tmpseTPdZ.py", line 4987, in onHit

ds_artikel = tmpCursor.getDataSet()

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

1397, in getDataSet

_correctFieldTypesIfNeeded(rec)

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

219, in _correctFieldTypesIfNeeded

rec[fld_name] = _correctFieldType(rec[fld_name], fld_name)

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

278, in _correctFieldType

return dec.quantize(Decimal("0.%s" % (scale * "0",)))

File "/usr/lib/python2.6/decimal.py", line 2358, in quantize

'quantize result has too many digits for current context')

File "/usr/lib/python2.6/decimal.py", line 3778, in _raise_error

raise error(explanation)

decimal.InvalidOperation: quantize result has too many digits for

current context

It somehow seems that the conversion of the database float-field "preis"

or the integer-field "anzahl" fails, but why? I use a mysql-backend if

that is important to know.

Has anybody an idea what can cause my problem?

Thanks in advance

Max

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/1367334231.5128.22.camel@max

©2013 Max Voß