commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7343 - in trunk/gnue-common/src/datasources/drivers: Base file


From: reinhard
Subject: [gnue] r7343 - in trunk/gnue-common/src/datasources/drivers: Base file
Date: Tue, 12 Apr 2005 03:19:28 -0500 (CDT)

Author: reinhard
Date: 2005-04-12 03:19:27 -0500 (Tue, 12 Apr 2005)
New Revision: 7343

Modified:
   trunk/gnue-common/src/datasources/drivers/Base/Connection.py
   trunk/gnue-common/src/datasources/drivers/file/Base.py
Log:
Implemented Connection._requery for file based drivers for the sake of
completeness.


Modified: trunk/gnue-common/src/datasources/drivers/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/Connection.py        
2005-04-12 07:50:49 UTC (rev 7342)
+++ trunk/gnue-common/src/datasources/drivers/Base/Connection.py        
2005-04-12 08:19:27 UTC (rev 7343)
@@ -203,11 +203,6 @@
     """
     Requery an existing record to reflect changes done by the backend.
 
-    The returned dictionary is I{not} guaranteed to hold all field given in the
-    fields list (especially for drivers that don't implement this feature).
-    Callers should update() their current field dictionary with the result of
-    this function.
-
     @param table: Table name.
     @param oldfields: Fieldname/Value dictionary of fields to find the existing
       record (aka where-clause).
@@ -557,7 +552,7 @@
     Requery an existing record to reflect changes done by the backend (to be
     implemented by descendants).
 
-    This method can be overwritten by descendants to return current data that
+    This method must be overwritten by descendants to return current data that
     might have changed automatically by the backend (e.g. through database
     triggers or appserver triggers) after an insert or update has been issued.
 

Modified: trunk/gnue-common/src/datasources/drivers/file/Base.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/file/Base.py      2005-04-12 
07:50:49 UTC (rev 7342)
+++ trunk/gnue-common/src/datasources/drivers/file/Base.py      2005-04-12 
08:19:27 UTC (rev 7343)
@@ -156,6 +156,23 @@
 
 
   # ---------------------------------------------------------------------------
+  # Implementation of (some) virtual methods
+  # ---------------------------------------------------------------------------
+
+  def _requery (self, table, oldfields, fields):
+    for row in self.getFile (table):
+      found = True
+      for (fieldname, value) in oldfields:
+        if row.get (fieldname) != value:
+          found = False
+      if found:
+        result = {}
+        for fieldname in fields:
+          result [fieldname] = row.get (fieldname)
+        return result
+
+
+  # ---------------------------------------------------------------------------
   # Get the filename for a given table
   # ---------------------------------------------------------------------------
 





reply via email to

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