Return None if the path is not found.
"""
+ # Use LIKE for comparison to avoid MySQL problems with trailing spaces.
+ path = path.replace('%', '\%')
+ path = path.replace('_', '\_')
s = select([self.nodes.c.node], self.nodes.c.path.like(path))
r = self.conn.execute(s)
row = r.fetchone()
self.statistics_update(parent, -nr, size, mtime, cluster)
self.statistics_update_ancestors(parent, -nr, size, mtime, cluster)
- s = select([self.versions.c.serial])
+ s = select([self.versions.c.hash])
s = s.where(where_clause)
r = self.conn.execute(s)
- hashes = [row[HASH] for row in r.fetchall()]
+ hashes = [row[0] for row in r.fetchall()]
r.close()
#delete versions
mtime = time()
self.statistics_update_ancestors(node, -nr, -size, mtime, cluster)
- s = select([self.versions.c.serial])
+ s = select([self.versions.c.hash])
s = s.where(where_clause)
r = self.conn.execute(s)
- hashes = [r[HASH] for r in r.fetchall()]
+ hashes = [r[0] for r in r.fetchall()]
r.close()
#delete versions
def version_remove(self, serial):
"""Remove the serial specified."""
- props = self.node_get_properties(serial)
+ props = self.version_get_properties(serial)
if not props:
return
node = props[NODE]
+ hash = props[HASH]
size = props[SIZE]
cluster = props[CLUSTER]
s = self.versions.delete().where(self.versions.c.serial == serial)
self.conn.execute(s).close()
- return True
+ return hash
def attribute_get(self, serial, keys=()):
"""Return a list of (key, value) pairs of the version specified by serial.