Paul McNett wrote:
> Paul McNett wrote:
>> Cool, sounds good now I need to test it!
> 
> Ok, my app now fails a save of a customer record, as of 3314:
> 
> Traceback (most recent call last):
>    File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dMenuItem.py", line 
> 48, in __onWxHit
>      self.raiseEvent(dEvents.Hit, evt)
>    File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dPemMixin.py", line 
> 843, in raiseEvent
>      super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
> **kwargs)
>    File "/home/pmcnett/dabo-full/trunk/dabo/lib/eventMixin.py", line 92, 
> in raiseEvent
>      bindingFunction(event)
>    File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dForm.py", line 658, 
> in onSave
>      def onSave(self, evt): self.save()
>    File "/home/pmcnett/dabo-full/trunk/dabo/lib/datanav2/Form.py", line 
> 53, in save
>      ret = super(Form, self).save(dataSource)
>    File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dForm.py", line 342, 
> in save
>      bizobj.saveAll()
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 276, 
> in saveAll
>      startTransaction=False)
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 689, 
> in scanChangedRows
>      func(*args, **kwargs)
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 337, 
> in save
>      self._onSaveNew()
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 1076, 
> in _onSaveNew
>      self.onSaveNew()
>    File 
> "/home/pmcnett/py/sbs/shutter_studio/trunk/clients/shutter_studio/biz/Customers.py",
>  
> line 70, in onSaveNew
>      self.save()
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 344, 
> in save
>      child.saveAll(startTransaction=False)
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 276, 
> in saveAll
>      startTransaction=False)
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 689, 
> in scanChangedRows
>      func(*args, **kwargs)
>    File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 378, 
> in save
>      self.afterSave()
>    File "/home/pmcnett/sst/clients/ss_common/biz/Base.py", line 20, in 
> afterSave
>      self.fillDerivedFields()
>    File 
> "/home/pmcnett/py/sbs/shutter_studio/trunk/clients/shutter_studio/biz/ProdCust.py",
>  
> line 24, in fillDerivedFields
>      cur.requery()
>    File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line 
> 371, in requery
>      self.execute(self.CurrentSQL, params, _fromRequery=True)
>    File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line 
> 295, in execute
>      self._storeFieldTypes()
>    File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line 
> 397, in _storeFieldTypes
>      for field in self.DataStructure:
>    File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line 
> 2067, in _getDataStructure
>      ds = self.BackendObject.getStructureDescription(self)
>    File "/home/pmcnett/dabo-full/trunk/dabo/db/dBackend.py", line 458, 
> in getStructureDescription
>      standard_fields = cursor.getFields()
>    File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line 
> 1671, in getFields
>      return self.BackendObject.getFields(tableName)
>    File "/home/pmcnett/dabo-full/trunk/dabo/db/dbSQLite.py", line 143, 
> in getFields
>      tempCursor.execute("pragma table_info('%s')" % tableName)
> pysqlite2.dbapi2.OperationalError: SQL logic error or missing database

Here's my code that executes that cur.requery() call:

  19   def fillDerivedFields(self):
  20     cur = self.getTempCursor()
  21
  22     # customer_name, customer_account:
  23     cur.UserSQL = "select name, account from customers where 
id='%s'" % self.Record.cust_id
  24     cur.requery()
  25     if cur.RowCount > 0:
  26       self.Record.customer_name = cur.Record.name
  27       self.Record.customer_account = cur.Record.account
  28     else:
  29       self.Record.customer_name = "?"
  30       self.Record.customer_account = "?"
  31
  32     # product_line_name:
  33     cur.UserSQL = "select name from product_lines where id='%s'" % 
self.Record.prod_id
  34     cur.requery()
  35     if cur.RowCount > 0:
  36       self.Record.product_line_name = cur.Record.name
  37     else:
  38       self.Record.product_line_name = "?"
  39



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]

Reply via email to