Commit 141ae33d authored by Vincent Pelletier's avatar Vincent Pelletier

Extract the code to split up trans.oids column into a oid list.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1935 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3d13e593
...@@ -29,6 +29,15 @@ from neo import util ...@@ -29,6 +29,15 @@ from neo import util
LOG_QUERIES = False LOG_QUERIES = False
def splitOIDField(tid, oids):
if (len(oids) % 8) != 0 or len(oids) == 0:
raise DatabaseFailure('invalid oids for tid %x' % tid)
oid_list = []
append = oid_list.append
for i in xrange(0, len(oids), 8):
append(oids[i:i+8])
return oid_list
class MySQLDatabaseManager(DatabaseManager): class MySQLDatabaseManager(DatabaseManager):
"""This class manages a database on MySQL.""" """This class manages a database on MySQL."""
...@@ -425,11 +434,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -425,11 +434,7 @@ class MySQLDatabaseManager(DatabaseManager):
self.commit() self.commit()
if r: if r:
oids, user, desc, ext, packed = r[0] oids, user, desc, ext, packed = r[0]
if (len(oids) % 8) != 0 or len(oids) == 0: oid_list = splitOIDField(tid, oids)
raise DatabaseFailure('invalid oids for tid %x' % tid)
oid_list = []
for i in xrange(0, len(oids), 8):
oid_list.append(oids[i:i+8])
return oid_list, user, desc, ext, bool(packed) return oid_list, user, desc, ext, bool(packed)
return None return None
......
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