[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6427 - trunk/gnue-common/src/schema/scripter
From: |
johannes |
Subject: |
r6427 - trunk/gnue-common/src/schema/scripter |
Date: |
Thu, 30 Sep 2004 02:26:39 -0500 (CDT) |
Author: johannes
Date: 2004-09-30 02:26:38 -0500 (Thu, 30 Sep 2004)
New Revision: 6427
Modified:
trunk/gnue-common/src/schema/scripter/Scripter.py
Log:
Display number inserted, changed and unmodified rows per table
Modified: trunk/gnue-common/src/schema/scripter/Scripter.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/Scripter.py 2004-09-29 20:30:42 UTC
(rev 6426)
+++ trunk/gnue-common/src/schema/scripter/Scripter.py 2004-09-30 07:26:38 UTC
(rev 6427)
@@ -517,8 +517,7 @@
(datasource, keyFields) = self.__openSource (table)
print o (u_(" updating table '%s' ...") % tablename)
- updCount = 0
- insCount = 0
+ stat = [0, 0, 0]
for row in table ['rows']:
cList = ['and']
@@ -538,9 +537,9 @@
if resultSet.firstRecord () is None:
resultSet.insertRecord ()
- insCount += 1
+ modIx = 0
else:
- updCount += 1
+ modIx = 1
doPost = False
@@ -554,12 +553,19 @@
if doPost:
resultSet.post ()
+ else:
+ modIx += 1
- self.connections.commitAll ()
- print o (u_(" Inserted %d row(s), updated %d row(s)") \
- % (insCount, updCount))
+ stat [modIx] += 1
+ if stat [0] + stat [1]:
+ self.connections.commitAll ()
+ print o (u_(" Rows: %(ins)d inserted, %(upd)d updated, %(kept)d "
+ "unchanged.") \
+ % {'ins': stat [0], 'upd': stat [1], 'kept': stat [2]})
+
+
# ---------------------------------------------------------------------------
# Prepare a datasource
# ---------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6427 - trunk/gnue-common/src/schema/scripter,
johannes <=