Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions genquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ def __repr__(self, **kw):
@property
def parameters(self): return dict((name,getattr(self,name)) for name in self.__parameter_names)

def copy(self,**options):
incorrect = list(k for k in options if k not in self.__parameter_names)
def copy(self,**parameter_changes):
Comment thread
trel marked this conversation as resolved.
Outdated
incorrect = list(k for k in parameter_changes if k not in self.__parameter_names)
if incorrect:
raise GenQuery_Options_Spec_Error('Incorrect option(s) to Query: '+', '.join(incorrect))
Comment thread
trel marked this conversation as resolved.
# let `options' override but not duplicate `self.parameters' in the keyword argument list
keyword_items_list = list(self.parameters.items()) + list(options.items())
# let `parameter_changes' override but not duplicate `self.parameters' in the keyword argument list
keyword_items_list = list(self.parameters.items()) + list(parameter_changes.items())
return Query(self.callback, **dict(keyword_items_list))
#return Query(self.callback, **{**self.parameters, **options})
#return Query(self.callback, **{**self.parameters, **parameter_changes})

def exec_if_not_yet_execed(self):
"""Query execution is delayed until the first result or total row count is requested."""
Expand Down Expand Up @@ -267,8 +267,7 @@ def total_rows(self):
# So instead, we run the query twice manually. This should
# perform only slightly worse.
# [1]: https://github.com/irods/irods/blob/4.2.6/plugins/database/src/general_query.cpp#L2393
self._total = Query(self.callback, self.columns, self.conditions, limit=0,
options=self.options|Option.RETURN_TOTAL_ROW_COUNT).total_rows()
self._total = self.copy(limit=0, options=self.options|Option.RETURN_TOTAL_ROW_COUNT).total_rows()
Comment thread
trel marked this conversation as resolved.
Outdated

return self._total

Expand Down
Loading