Commit 60cbb2d8 authored by Grégory Wisniewski's avatar Grégory Wisniewski

deleteObjectsAbove deals with obj_short too.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2583 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 92ac456c
...@@ -597,7 +597,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -597,7 +597,7 @@ class MySQLDatabaseManager(DatabaseManager):
u64 = util.u64 u64 = util.u64
self.begin() self.begin()
try: try:
self.query('DELETE FROM obj WHERE partition=%(partition)d AND (' self.objQuery('DELETE FROM %%(table)s WHERE partition=%(partition)d AND ('
'oid > %(oid)d OR (oid = %(oid)d AND serial >= %(serial)d))' % { 'oid > %(oid)d OR (oid = %(oid)d AND serial >= %(serial)d))' % {
'partition': partition, 'partition': partition,
'oid': u64(oid), 'oid': u64(oid),
......
...@@ -382,6 +382,10 @@ class StorageDBTests(NeoUnitTestBase): ...@@ -382,6 +382,10 @@ class StorageDBTests(NeoUnitTestBase):
self.db.storeTransaction(tid, objs, txn) self.db.storeTransaction(tid, objs, txn)
self.db.finishTransaction(tid) self.db.finishTransaction(tid)
self.db.deleteObjectsAbove(2, 0, oid1, tid2) self.db.deleteObjectsAbove(2, 0, oid1, tid2)
# Check getObjectHistoryFrom because MySQL adapter use two tables
# that must be synchronized
self.assertEqual(self.db.getObjectHistoryFrom(ZERO_OID, ZERO_TID,
MAX_TID, 10, 2, 0), {oid1: [tid1]})
# Right partition, below cutoff # Right partition, below cutoff
self.assertNotEqual(self.db.getObject(oid1, tid=tid1), None) self.assertNotEqual(self.db.getObject(oid1, tid=tid1), None)
# Right partition, above tid cutoff # Right partition, above tid cutoff
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment