[Modeling-cvs] ProjectModeling/Modeling DatabaseChannel.py,1.14,1.15
Status: Abandoned
Brought to you by:
sbigaret
|
From: <sbi...@us...> - 2003-07-18 11:44:49
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv28258
Modified Files:
DatabaseChannel.py
Log Message:
Quicker implementation of fetchObject() w/ raw rows: runs at the same speed (or almost) when the ec has no objects, and when the EC already has the objects and these objects are NOT modified
Index: DatabaseChannel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseChannel.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** DatabaseChannel.py 16 Jul 2003 19:16:00 -0000 1.14
--- DatabaseChannel.py 18 Jul 2003 11:44:46 -0000 1.15
***************
*** 153,161 ****
if self.fetchesRawRows():
ec=self._editingContext
! object=ec.objectForGlobalID(globalID)
! if object is not None:
! return object.snapshot_raw()
else:
! return dict
# Get snapshot
--- 153,184 ----
if self.fetchesRawRows():
ec=self._editingContext
! ## Implementation note:
! # we formerly had the straighforward code:
! # object=ec.objectForGlobalID(globalID)
! # if object is not None:
! # return object.snapshot_raw()
! #
! # This works, but the more objects were already loaded within the
! # EditingContext, the slower it was. So we changed it to this version,
! # which does not have this drawback. However, obviously, the more
! # updated objects we have in the EditingContext, the slower it will be.
! # This CANNOT be changed: if an object is modified, its current state
! # should be reflected in the result set.
! if globalID in ec.allUpdatedGlobalIDs():
! return ec.objectForGlobalID(globalID).snapshot_raw()
else:
! # Check the database cache: if it's already cached, use the cached
! # snapshot instead of the row coming from the db. If we do not do
! # this and the row has been changed independently from the framework,
! # then we'll get the raw snapshot and the corresponding object not
! # exposing the same values --and we do not want that, this is not
! # our problem here, rather, this would be handled w/ optimistic
! # locking.
! database=self.databaseContext().database()
! registeredSnapshot=database.snapshotForGlobalID(globalID)
! if registeredSnapshot:
! return registeredSnapshot
! else:
! return dict
# Get snapshot
|