|
@@ -72,7 +72,12 @@ class DatabaseQuery(object): |
|
|
self.fields.append(t + ".name as '%s:name'" % t[4:-1]) |
|
|
self.fields.append(t + ".name as '%s:name'" % t[4:-1]) |
|
|
|
|
|
|
|
|
# query dict |
|
|
# query dict |
|
|
args.tables = ', '.join(self.tables) |
|
|
|
|
|
|
|
|
args.tables = self.tables[0] |
|
|
|
|
|
|
|
|
|
|
|
# left join parent, child tables |
|
|
|
|
|
for tname in self.tables[1:]: |
|
|
|
|
|
args.tables += " left join " + tname + " on " + tname + '.parent = ' + self.tables[0] + '.name' |
|
|
|
|
|
|
|
|
if self.or_conditions: |
|
|
if self.or_conditions: |
|
|
self.conditions.append("({0})".format(" or ".join(self.or_conditions))) |
|
|
self.conditions.append("({0})".format(" or ".join(self.or_conditions))) |
|
|
args.conditions = ' and '.join(self.conditions) |
|
|
args.conditions = ' and '.join(self.conditions) |
|
@@ -165,10 +170,6 @@ class DatabaseQuery(object): |
|
|
self.build_filter_conditions(self.filters, self.conditions) |
|
|
self.build_filter_conditions(self.filters, self.conditions) |
|
|
self.build_filter_conditions(self.or_filters, self.or_conditions) |
|
|
self.build_filter_conditions(self.or_filters, self.or_conditions) |
|
|
|
|
|
|
|
|
# join parent, child tables |
|
|
|
|
|
for tname in self.tables[1:]: |
|
|
|
|
|
self.conditions.append(tname + '.parent = ' + self.tables[0] + '.name') |
|
|
|
|
|
|
|
|
|
|
|
# match conditions |
|
|
# match conditions |
|
|
if not self.ignore_permissions: |
|
|
if not self.ignore_permissions: |
|
|
match_conditions = self.build_match_conditions() |
|
|
match_conditions = self.build_match_conditions() |
|
|