commit-gnue
[Top][All Lists]
Advanced

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

r6383 - trunk/gnue-common/src/schema/scripter


From: johannes
Subject: r6383 - trunk/gnue-common/src/schema/scripter
Date: Thu, 23 Sep 2004 10:17:36 -0500 (CDT)

Author: johannes
Date: 2004-09-23 10:17:35 -0500 (Thu, 23 Sep 2004)
New Revision: 6383

Modified:
   trunk/gnue-common/src/schema/scripter/Scripter.py
Log:
Only change those fields which has been modified


Modified: trunk/gnue-common/src/schema/scripter/Scripter.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/Scripter.py   2004-09-23 15:03:06 UTC 
(rev 6382)
+++ trunk/gnue-common/src/schema/scripter/Scripter.py   2004-09-23 15:17:35 UTC 
(rev 6383)
@@ -528,6 +528,8 @@
 
           cList.append (['eq', ['field', keyField], ['const', kvalue]])
 
+        gDebug (4, "Condition: %s" % cList)
+
         condition = GConditions.buildTreeFromList (cList)
         resultSet = datasource.createResultSet (condition)
 
@@ -537,11 +539,22 @@
         else:
           updCount += 1
 
+        doPost = False
+
         for field in row ['fields']:
-          resultSet.current.setField (field ['name'], field ['value'])
+          fieldName  = field ['name']
+          fieldValue = field ['value']
+          gDebug (4, "Field %s: old %s" % (fieldName,
+                            resultSet.current.getField (fieldName)))
+          gDebug (4, "Field %s: new %s" % (fieldName, fieldValue))
 
-        resultSet.post ()
+          if resultSet.current.getField (fieldName) != fieldValue:
+            resultSet.current.setField (fieldName, fieldValue)
+            doPost = True
 
+        if doPost:
+          resultSet.post ()
+
       self.connections.commitAll ()
       print o (u_("    Inserted %d row(s), updated %d row(s)") \
                % (insCount, updCount))





reply via email to

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