[Checkins] SVN: relstorage/ Fixed an Oracle bug in the new code

Shane Hathaway shane at hathawaymix.org
Tue Feb 1 09:43:13 EST 2011


Log message for revision 120038:
  Fixed an Oracle bug in the new code
  

Changed:
  U   relstorage/branches/1.4/relstorage/adapters/packundo.py
  U   relstorage/trunk/relstorage/adapters/packundo.py

-=-
Modified: relstorage/branches/1.4/relstorage/adapters/packundo.py
===================================================================
--- relstorage/branches/1.4/relstorage/adapters/packundo.py	2011-02-01 12:05:17 UTC (rev 120037)
+++ relstorage/branches/1.4/relstorage/adapters/packundo.py	2011-02-01 14:43:13 UTC (rev 120038)
@@ -926,13 +926,10 @@
         WHERE zoid IN (%s)
         """ % oid_list
         self.runner.run_script_stmt(cursor, stmt)
-        rows = list(cursor)
-        if not rows:
-            return 0
 
         add_objects = []
         add_refs = []
-        for from_oid, tid, state in rows:
+        for from_oid, tid, state in cursor:
             if hasattr(state, 'read'):
                 # Oracle
                 state = state.read()
@@ -948,6 +945,9 @@
                 for to_oid in to_oids:
                     add_refs.append((from_oid, tid, to_oid))
 
+        if not add_objects:
+            return 0
+
         stmt = "DELETE FROM object_refs_added WHERE zoid IN (%s)" % oid_list
         self.runner.run_script_stmt(cursor, stmt)
         stmt = "DELETE FROM object_ref WHERE zoid IN (%s)" % oid_list

Modified: relstorage/trunk/relstorage/adapters/packundo.py
===================================================================
--- relstorage/trunk/relstorage/adapters/packundo.py	2011-02-01 12:05:17 UTC (rev 120037)
+++ relstorage/trunk/relstorage/adapters/packundo.py	2011-02-01 14:43:13 UTC (rev 120038)
@@ -934,13 +934,10 @@
         WHERE zoid IN (%s)
         """ % oid_list
         self.runner.run_script_stmt(cursor, stmt)
-        rows = list(cursor)
-        if not rows:
-            return 0
 
         add_objects = []
         add_refs = []
-        for from_oid, tid, state in rows:
+        for from_oid, tid, state in cursor:
             if hasattr(state, 'read'):
                 # Oracle
                 state = state.read()
@@ -956,6 +953,9 @@
                 for to_oid in to_oids:
                     add_refs.append((from_oid, tid, to_oid))
 
+        if not add_objects:
+            return 0
+
         stmt = "DELETE FROM object_refs_added WHERE zoid IN (%s)" % oid_list
         self.runner.run_script_stmt(cursor, stmt)
         stmt = "DELETE FROM object_ref WHERE zoid IN (%s)" % oid_list



More information about the checkins mailing list