43
44
def __init__(self, filename):
44
45
create_table = not os.path.exists(filename)
45
46
self.connection = dbapi2.connect(filename)
46
47
self.cursor = self.connection.cursor()
51
53
"create table RevisionData "
52
54
"(revid binary primary key, data binary)")
54
57
def _serialize(self, obj):
55
58
r = dbapi2.Binary(cPickle.dumps(obj, protocol=2))
57
61
def _unserialize(self, data):
58
62
return cPickle.loads(str(data))
62
67
filechange = self.cursor.fetchone()
66
71
return self._unserialize(filechange[0])
67
73
def add(self, revid_obj_pairs):
70
76
"insert into revisiondata (revid, data) values (?, ?)",