Hi !
While constructing bizobj's UserSQL   (instead of auto SQL), I have the 
following problem---
Here's the code.
---------------------------------- mybiz.py 
----------------------------------------------
import dabo
ci = dabo.db.dConnectInfo(Host='myhost', DbType='MySQL', Database='mydb', 
User='myusername', PlainTextPassword='mypass')
oConn = dabo.db.dConnection(ci)

class PublicDistBizobj(dabo.biz.dBizobj):
    def afterInit(self):
        self.DataSource ='dist'
        self.KeyField = 'distid'
#        self.addFrom('dist')
#        self.addField('distid')
#        self.addField('distnm')
#        self.addField('statid')
        self.UserSQL = 'select distid,distnm,statid from stat'
        self.NonUpdateFields = ['distid']

class PublicStatBizobj(dabo.biz.dBizobj):
    def afterInit(self):
        self.DataSource = 'stat'
#        self.KeyField = 'statid'
#        self.addFrom('stat')
#        self.addField('statid')
#        self.addField('statnm')
        self.UserSQL = 'select statid,statnm from stat'
        self.NonUpdateFields = ['statid']

statBizObj = PublicStatBizobj(oConn)
distBizObj = PublicDistBizobj(oConn)

distBizObj.LinkField = 'statid'
statBizObj.addChild(distBizObj)

---------------------------------- eof 
----------------------------------------------
on the python prompt---
If I do NOT use UserSQL (comment out the UserSQL), everything is OK.
If I use UserSQL, the results are reproduced below ----

>> import mybiz
>> mybiz.distBizObj.requery()
(No problem here. The Command works OK)
I can get the records in distBizObj (confirmed through getDataSet())

>> mybiz.statBizObj.requery()

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "f:\py\dabo\biz\dBizobj.py", line 997, in requery
    self.requeryAllChildren()
  File "f:\py\dabo\biz\dBizobj.py", line 1500, in requeryAllChildren
    child.requery()
  File "f:\py\dabo\biz\dBizobj.py", line 978, in requery
    cursor.requery(params)
  File "f:\py\dabo\db\dCursorMixin.py", line 460, in requery
    self.execute(currSQL, params, _newQuery=newQuery)
  File "f:\py\dabo\db\dCursorMixin.py", line 355, in execute
    raise dException.DBQueryException(errMsg)
DBQueryException: not all arguments converted during string formatting

INFO:dbActivityLog:SQL: select 'statid',   'statnm',  from 'stat'  limit 1000
INFO:dbActivityLog:SQL: describe 'stat'
INFO:dbActivityLog:FAILED SQL: select distid,distnm,statidfrom dist where 
dist.statid=1 , PARAMS: 1
INFO:dbActivityLog:DBQueryExceptionencountered in execute(): not all arguments 
converted during string formatting
select distid,distnm,statidfrom dist where dist.statid=1


Now if I requery 'statBizObj' again (which was executed OK first time).--
>> mybiz.distBizObj.requery()
it gives traceback (same as the one reproduced above)

---------------------------------------------------------------------------
Another thing-- If I use UserSQL for 'PublicStatBizobj' only; 
and use auto SQL (generated by dabo) for 'PublicDistBizobj', everything works 
perfect.
---------------------------------------------------------------------------
Can anybody pl. point out what's the dark spot in this code?

Thanks,
Vineet

--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to