Revision 96090728 snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py | ||
---|---|---|
241 | 241 |
""" |
242 | 242 |
|
243 | 243 |
# Use LIKE for comparison to avoid MySQL problems with trailing spaces. |
244 |
s = select([self.nodes.c.node], self.nodes.c.path.like( |
|
245 |
self.escape_like(path), escape=ESCAPE_CHAR), for_update=for_update) |
|
244 |
s = select([self.nodes.c.node], |
|
245 |
self.nodes.c.path.like(self.escape_like(path), |
|
246 |
escape=ESCAPE_CHAR), |
|
247 |
for_update=for_update) |
|
246 | 248 |
r = self.conn.execute(s) |
247 | 249 |
row = r.fetchone() |
248 | 250 |
r.close() |
... | ... | |
668 | 670 |
else: |
669 | 671 |
c1 = select([self.nodes.c.latest_version], |
670 | 672 |
self.nodes.c.node == v.c.node) |
671 |
c2 = select([self.nodes.c.node], self.nodes.c.path.like( |
|
672 |
self.escape_like(path) + '%', escape=ESCAPE_CHAR)) |
|
673 |
c2 = select([self.nodes.c.node], |
|
674 |
self.nodes.c.path.like(self.escape_like(path) + '%', |
|
675 |
escape=ESCAPE_CHAR)) |
|
673 | 676 |
s = s.where(and_(v.c.serial == c1, |
674 | 677 |
v.c.cluster != except_cluster, |
675 | 678 |
v.c.node.in_(c2))) |
... | ... | |
933 | 936 |
self.attributes.c.serial == dest, |
934 | 937 |
self.attributes.c.domain == domain, |
935 | 938 |
self.attributes.c.key == k)) |
936 |
s = s.values(node = select_src_node, value=v)
|
|
939 |
s = s.values(node=select_src_node, value=v)
|
|
937 | 940 |
rp = self.conn.execute(s) |
938 | 941 |
rp.close() |
939 | 942 |
if rp.rowcount == 0: |
... | ... | |
979 | 982 |
conj = [] |
980 | 983 |
for path, match in pathq: |
981 | 984 |
if match == MATCH_PREFIX: |
982 |
conj.append( |
|
983 |
n.c.path.like( |
|
984 |
self.escape_like(path) + '%', |
|
985 |
escape=ESCAPE_CHAR |
|
986 |
) |
|
987 |
) |
|
985 |
conj.append(n.c.path.like(self.escape_like(path) + '%', |
|
986 |
escape=ESCAPE_CHAR)) |
|
988 | 987 |
elif match == MATCH_EXACT: |
989 | 988 |
conj.append(n.c.path == path) |
990 | 989 |
if conj: |
... | ... | |
1079 | 1078 |
conj = [] |
1080 | 1079 |
for path, match in pathq: |
1081 | 1080 |
if match == MATCH_PREFIX: |
1082 |
conj.append( |
|
1083 |
n.c.path.like( |
|
1084 |
self.escape_like(path) + '%', |
|
1085 |
escape=ESCAPE_CHAR |
|
1086 |
) |
|
1087 |
) |
|
1081 |
conj.append(n.c.path.like(self.escape_like(path) + '%', |
|
1082 |
escape=ESCAPE_CHAR)) |
|
1088 | 1083 |
elif match == MATCH_EXACT: |
1089 | 1084 |
conj.append(n.c.path == path) |
1090 | 1085 |
if conj: |
Also available in: Unified diff