Revision 4a7b190f snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py | ||
---|---|---|
1006 | 1006 |
s = s.where(self.attributes.c.serial == self.versions.c.serial) |
1007 | 1007 |
s = s.where(self.attributes.c.domain == domain) |
1008 | 1008 |
s = s.where(self.nodes.c.node == self.versions.c.node) |
1009 |
conj = [] |
|
1009 |
conja = [] |
|
1010 |
conjb = [] |
|
1010 | 1011 |
for path, match in pathq: |
1011 | 1012 |
if match == MATCH_PREFIX: |
1012 |
conj.append(self.nodes.c.path.like(self.escape_like(path) + '%', |
|
1013 |
conja.append(self.nodes.c.path.like(self.escape_like(path) + '%',
|
|
1013 | 1014 |
escape=ESCAPE_CHAR)) |
1014 | 1015 |
elif match == MATCH_EXACT: |
1015 |
conj.append(self.nodes.c.path == path)
|
|
1016 |
if conj: |
|
1017 |
s = s.where(or_(*conj))
|
|
1016 |
conjb.append(path)
|
|
1017 |
if conja or conjb:
|
|
1018 |
s = s.where(or_(self.nodes.c.path.in_(conjb),*conja))
|
|
1018 | 1019 |
rp = self.conn.execute(s) |
1019 | 1020 |
rows = rp.fetchall() |
1020 | 1021 |
rp.close() |
... | ... | |
1115 | 1116 |
s = s.where(self.versions.c.node == self.nodes.c.node) |
1116 | 1117 |
s = s.where(and_(self.nodes.c.path > bindparam('start'), |
1117 | 1118 |
self.nodes.c.path < nextling)) |
1118 |
conj = [] |
|
1119 |
conja = [] |
|
1120 |
conjb = [] |
|
1119 | 1121 |
for path, match in pathq: |
1120 | 1122 |
if match == MATCH_PREFIX: |
1121 |
conj.append(self.nodes.c.path.like(self.escape_like(path) + '%', |
|
1123 |
conja.append(self.nodes.c.path.like(self.escape_like(path) + '%',
|
|
1122 | 1124 |
escape=ESCAPE_CHAR)) |
1123 | 1125 |
elif match == MATCH_EXACT: |
1124 |
conj.append(self.nodes.c.path == path)
|
|
1125 |
if conj: |
|
1126 |
s = s.where(or_(*conj))
|
|
1126 |
conjb.append(path)
|
|
1127 |
if conja or conjb:
|
|
1128 |
s = s.where(or_(self.nodes.c.path.in_(conjb),*conja))
|
|
1127 | 1129 |
|
1128 | 1130 |
if sizeq and len(sizeq) == 2: |
1129 | 1131 |
if sizeq[0]: |
Also available in: Unified diff