The deeper I am delving into dabo, the more queries I come up with. Let me take the help of a test code suggested by Paul. My queries are embedded at the concerned code line; numbered as 1) and 2) ++++ paultest.py++++ import dabo
con = dabo.db.connect(":memory:") cur = con.cursor() #create tables cur.execute("create table parenT (pid integer PRIMARY KEY AUTOINCREMENT NOT NULL, pfirstname char)") cur.execute("create table chilD (cid integer PRIMARY KEY AUTOINCREMENT NOT NULL, pid integer, cfirstname char, FOREIGN KEY(pid) REFERENCES parenT(pid))") cur.execute("create table grandchilD (gid integer PRIMARY KEY AUTOINCREMENT NOT NULL, cid integer, gfirstname char, FOREIGN KEY(cid) REFERENCES chilD(cid))") #populate parenT table cur.execute("insert into parenT (pid, pfirstname) values (1, 'Paul')") cur.execute("insert into parenT (pid, pfirstname) values (2, 'Ed')") #classes for bizobjs class pBiz(dabo.biz.dBizobj): def initProperties(self): self.DataSource = "parenT" self.KeyField = "pid" self.UserSQL = 'select * from parenT where pid=?' class cBiz(dabo.biz.dBizobj): def initProperties(self): self.DataSource = "chilD" self.KeyField = "cid" self.FillLinkFromParent = True class gBiz(dabo.biz.dBizobj): def initProperties(self): self.DataSource = "grandchilD" self.KeyField = "gid" self.FillLinkFromParent = True #instantiate bizobjs PBiz = pBiz(con) CBiz = cBiz(con) GBiz = gBiz(con) #setup relationships PBiz.addChild(CBiz) CBiz.LinkField = 'pid' CBiz.addChild(GBiz) GBiz.LinkField = 'cid' #add some records to childs CBiz.new() CBiz.setFieldVals({'cid':1, 'pid':1, 'cfirstname':'paul_child'}) GBiz.new() GBiz.setFieldVals({'gid':1, 'cid':1, 'gfirstname':'paul_grandchild'}) CBiz.saveAll() ### 1) Which method is appropriate: saveAll() or save() ; and it should be called for which bizobj? PBiz or CBiz? I guess: save() when calling on Parent | saveAll() when calling on child ### PBiz.setParams(1) PBiz.requery() print "Testing parenT:", PBiz.getDataSet() print "Testing chilD:", CBiz.getDataSet() print "Testing grandchilD:", GBiz.getDataSet() ### 2) Coming to delete() + requery() methods >> paultest.CBiz.setParams(1) >> paultest.CBiz.requery() >> paultest.CBiz.seek(1, 'cid') >> paultest.CBiz.delete() OK.... Now I want to requery() PBiz >> paultest.PBiz.setParams(1) # If I don't set params for PBiz here, it will be incorrect. But cascadingly, it sets param again for CBiz & GBiz, which causes problem in requery childs. >> paultest.PBiz.requery() For PBiz requery, params are (1,) But while requery() on children, params are (1, 1) So it throws exception-- DBQueryException: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied. How do I handle this? Regards, Vineet _______________________________________________ Post Messages to: Dabo-users@leafe.com 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/4e9806d1.5090...@yahoo.com