commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r6574 - in trunk: gnue-appserver/src gnue-common/src/datasources/drivers


From: johannes
Subject: r6574 - in trunk: gnue-appserver/src gnue-common/src/datasources/drivers/appserver/appserver gnue-forms/src/GFObjects
Date: Thu, 28 Oct 2004 02:37:41 -0500 (CDT)

Author: johannes
Date: 2004-10-28 02:37:38 -0500 (Thu, 28 Oct 2004)
New Revision: 6574

Modified:
   trunk/gnue-appserver/src/data.py
   trunk/gnue-appserver/src/geasInstance.py
   trunk/gnue-appserver/src/geasSession.py
   trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py
   trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
Fixed master-/detail-issues


Modified: trunk/gnue-appserver/src/data.py
===================================================================
--- trunk/gnue-appserver/src/data.py    2004-10-27 09:11:25 UTC (rev 6573)
+++ trunk/gnue-appserver/src/data.py    2004-10-28 07:37:38 UTC (rev 6574)
@@ -100,14 +100,10 @@
     fields [field] = value
 
     # Update state information of the row
-    if self.__getState (table, row) is None:
-      self.__setState (table, row, 'initializing')
+    self.touch (table, row, dirty)
 
-    if dirty and self.__getState (table, row) == 'initialized':
-      self.__setState (table, row, 'commitable')
 
 
-
   # ---------------------------------------------------------------------------
   # Return whether a certain value is stored in the clean/dirty cache
   # ---------------------------------------------------------------------------
@@ -311,6 +307,31 @@
     else:
       return None
 
+
+  # ---------------------------------------------------------------------------
+  # Touch a record in the cache
+  # ---------------------------------------------------------------------------
+
+  def touch (self, table, row, dirty = True):
+    """
+    This function touches a record in the cache. If has no state information it
+    will be stet to 'initializing' and if the dirty flag is set and state is
+    already 'initialized' the record get's 'commitable'
+
+    @param table: name of the table to be touched
+    @param row: gnue_id of the row to be touched
+    @param dirty: boolean flag to state wether to make the record dirty or not
+    """
+
+    # Update state information of the row
+    if self.__getState (table, row) is None:
+      self.__setState (table, row, 'initializing')
+
+    if dirty and self.__getState (table, row) == 'initialized':
+      self.__setState (table, row, 'commitable')
+
+
+
 # =============================================================================
 # Helper methods
 # =============================================================================
@@ -953,6 +974,18 @@
     return self.__cache.status (self.__table, self.__row)
 
 
+  # ---------------------------------------------------------------------------
+  # Touch a record in the cache
+  # ---------------------------------------------------------------------------
+
+  def touch (self, dirty = True):
+    """
+    This function touches the underlying record in the cache.
+    """
+
+    self.__cache.touch (self.__table, self.__row, dirty)
+
+
 # =============================================================================
 # Self test code
 # =============================================================================

Modified: trunk/gnue-appserver/src/geasInstance.py
===================================================================
--- trunk/gnue-appserver/src/geasInstance.py    2004-10-27 09:11:25 UTC (rev 
6573)
+++ trunk/gnue-appserver/src/geasInstance.py    2004-10-28 07:37:38 UTC (rev 
6574)
@@ -399,6 +399,26 @@
 
   def status (self):
     """
+    This function returns the current state of the encapsulated record in the
+    cache.
+
+    @return: state of the record in the cache
     """
 
     return self.__record.status ()
+
+
+  # ---------------------------------------------------------------------------
+  # Touch the record in the cache
+  # ---------------------------------------------------------------------------
+
+  def touch (self, dirty = True):
+    """
+    This function touches the encapsulated record in the cache. If the record
+    has been initialized already it becomes 'commitable' this way.
+
+    @param dirty: if set to TRUE an 'initialized' record becomes 'commitable',
+        otherwise it might change to 'initializing' only.
+    """
+
+    self.__record.touch (dirty)

Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py     2004-10-27 09:11:25 UTC (rev 
6573)
+++ trunk/gnue-appserver/src/geasSession.py     2004-10-28 07:37:38 UTC (rev 
6574)
@@ -472,6 +472,10 @@
       for object_id in obj_id_list:
         if object_id:
           instance = self.__findInstance (classdef, object_id, [])
+          # make sure an 'initialized' record get's commitable, even if no
+          # further access to the instance occurs
+          instance.touch ()
+
           new_object_id = object_id
 
         else:

Modified: 
trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py  
2004-10-27 09:11:25 UTC (rev 6573)
+++ trunk/gnue-common/src/datasources/drivers/appserver/appserver/RecordSet.py  
2004-10-28 07:37:38 UTC (rev 6574)
@@ -114,15 +114,21 @@
     insert = self._insertFlag
     update = self._updateFlag
 
-    self.post ()
+    # Find out the top level record set regarding to master-/detail and call
+    # this recordset's post (). This will do implicit post's on the details
+    current = self._parent
 
+    while current._masterRecordSet is not None:
+      current = current._masterRecordSet._parent
+
+    current.post ()
+
     try:
       result = self.__sm.call (self.__session_id,
                                self.__classname,
                                [self._fields ['gnue_id']],
                                methodname,
                                parameters) [0]
-
       self.__updateFields ()
 
       self._updateFlag = True

Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2004-10-27 09:11:25 UTC (rev 
6573)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2004-10-28 07:37:38 UTC (rev 
6574)
@@ -585,8 +585,14 @@
     if not recovering:
       self._currentRecord = 0
       self._recordCount   = 0
-      self._dataSourceLink.createEmptyResultSet ()
 
+      if not self._dataSourceLink.hasMaster ():
+        self._dataSourceLink.createEmptyResultSet ()
+      else:
+        # if we have a master make sure to keep in touch with it
+        self._dataSourceLink.createEmptyResultSet ( \
+            masterRecordSet = self._resultSet._masterRecordSet)
+
     self.switchRecord (0)
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]