dabo Commit
Revision 6425
Date: 2011-02-11 10:39:59 -0800 (Fri, 11 Feb 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6425

Changed:
U   trunk/dabo/biz/dBizobj.py

Log:
Optimizing children cursors requery for non matching FK.

Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2011-02-11 17:47:04 UTC (rev 6424)
+++ trunk/dabo/biz/dBizobj.py   2011-02-11 18:39:59 UTC (rev 6425)
@@ -986,42 +986,43 @@
                # Hook method for creating the param tuple. Note that the child 
filter
                # clause, if any, will always be the first clause in the WHERE 
expression.
                params = _childParamTuple + self.getParams()
-
-               # Record this in case we need to restore the record position
-               try:
-                       currPK = self.getPK()
-               except dException.NoRecordsException:
-                       currPK = None
-
-               oldDataStructure = hash(self.DataStructure)
-               # run the requery
                uiException = None
-               cursor = self._CurrentCursor
-               try:
-                       cursor.requery(params)
-               except dException.ConnectionLostException:
-                       raise
-               except dException.DBQueryException:
-                       raise
-               except dException.NoRecordsException:
-                       # Pass the exception to the UI
-                       uiException = dException.NoRecordsException
-               except dException.dException:
-                       raise
 
-               if self.RestorePositionOnRequery:
-                       self._positionUsingPK(currPK)
+               # Since the FK value can't be None, we don't need to run non 
matching
+               # parameters requery in such situation.  
+               if not (self.Parent and self.LinkField and _childParamTuple and 
\
+                               max(_childParamTuple) is None):
+                       # Record this in case we need to restore the record 
position
+                       try:
+                               currPK = self.getPK()
+                       except dException.NoRecordsException:
+                               currPK = None
+                       oldDataStructure = hash(self.DataStructure)
+                       # run the requery
+                       cursor = self._CurrentCursor
+                       try:
+                               cursor.requery(params)
+                       except dException.ConnectionLostException:
+                               raise
+                       except dException.DBQueryException:
+                               raise
+                       except dException.NoRecordsException:
+                               # Pass the exception to the UI
+                               uiException = dException.NoRecordsException
+                       except dException.dException:
+                               raise
+                       if self.RestorePositionOnRequery:
+                               self._positionUsingPK(currPK, 
updateChildren=False)
+                       if hash(self.DataStructure) != oldDataStructure:
+                               self._clearCursorRecord()
 
                try:
                        self.requeryAllChildren()
                except dException.NoRecordsException:
                        pass
                self.afterRequery()
-
                if uiException:
                        raise uiException
-               if hash(self.DataStructure) != oldDataStructure:
-                       self._clearCursorRecord()
 
 
        def _clearCursorRecord(self):



_______________________________________________
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/[email protected]

Reply via email to