changeset 974:84216d63ed9c

ahhh, I understand now
author Richard Jones <richard@users.sourceforge.net>
date Fri, 23 Aug 2002 04:58:00 +0000
parents e21259073500
children 2ab4d496d936
files roundup/backends/back_gadfly.py test/test_db.py
diffstat 2 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/backends/back_gadfly.py	Fri Aug 23 04:48:36 2002 +0000
+++ b/roundup/backends/back_gadfly.py	Fri Aug 23 04:58:00 2002 +0000
@@ -1,4 +1,4 @@
-# $Id: back_gadfly.py,v 1.2 2002-08-23 04:48:10 richard Exp $
+# $Id: back_gadfly.py,v 1.3 2002-08-23 04:58:00 richard Exp $
 __doc__ = '''
 About Gadfly
 ============
@@ -710,8 +710,7 @@
         return res
 
     def pack(self, pack_before):
-        ''' Pack the database, removing all journal entries before the
-            "pack_before" date.
+        ''' Delete all journal entries except "create" before 'pack_before'.
         '''
         # get a 'yyyymmddhhmmss' version of the date
         date_stamp = pack_before.serialise()
@@ -719,7 +718,8 @@
         # do the delete
         cursor = self.conn.cursor()
         for classname in self.classes.keys():
-            sql = 'delete from %s__journal where date<?'%classname
+            sql = "delete from %s__journal where date<? and "\
+                "action<>'create'"%classname
             if __debug__:
                 print >>hyperdb.DEBUG, 'pack', (self, sql, date_stamp)
             cursor.execute(sql, (date_stamp,))
@@ -1645,6 +1645,20 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.2  2002/08/23 04:48:10  richard
+# That's gadfly done, mostly. Things left:
+# - Class.filter (I'm a wuss ;)
+# - schema changes adding new non-multilink properties are not implemented.
+#   gadfly doesn't have an ALTER TABLE command, making that quite difficult :)
+#
+# I had to mangle two unit tests to get this all working:
+# - gadfly also can't handle two handles open on the one database, so
+#   testIDGeneration doesn't try that.
+# - testNewProperty is disabled as per the second comment above.
+#
+# I noticed test_pack was incorrect, and the *dbm tests fail there now.
+# Looking into it...
+#
 # Revision 1.1  2002/08/22 07:56:51  richard
 # Whee! It's not finished yet, but I can create a new instance and play with
 # it a little bit :)
--- a/test/test_db.py	Fri Aug 23 04:48:36 2002 +0000
+++ b/test/test_db.py	Fri Aug 23 04:58:00 2002 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: test_db.py,v 1.40 2002-08-23 04:48:36 richard Exp $ 
+# $Id: test_db.py,v 1.41 2002-08-23 04:58:00 richard Exp $ 
 
 import unittest, os, shutil, time
 
@@ -413,8 +413,8 @@
         self.db.pack(pack_before)
         journal = self.db.getjournal('issue', '1')
 
-        # we should have one entry now
-        self.assertEqual(1, len(journal))
+        # we should have the create and last set entries now
+        self.assertEqual(2, len(journal))
 
     def testIDGeneration(self):
         id1 = self.db.issue.create(title="spam", status='1')
@@ -668,6 +668,9 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.40  2002/08/23 04:48:36  richard
+# oops, forgot
+#
 # Revision 1.39  2002/07/31 23:57:37  richard
 #  . web forms may now unset Link values (like assignedto)
 #

Roundup Issue Tracker: http://roundup-tracker.org/