Adjust the limits on the rows retrieved. Use low/high to set these, as it makes it more Pythonic to read and write. When the SQL query is created, convert them to the appropriate offset and limit values. Apply any limits passed in here to the existing constraints. A
(self, low=None, high=None)
| 2187 | return any(isinstance(c, NothingNode) for c in self.where.children) |
| 2188 | |
| 2189 | def set_limits(self, low=None, high=None): |
| 2190 | """ |
| 2191 | Adjust the limits on the rows retrieved. Use low/high to set these, |
| 2192 | as it makes it more Pythonic to read and write. When the SQL query is |
| 2193 | created, convert them to the appropriate offset and limit values. |
| 2194 | |
| 2195 | Apply any limits passed in here to the existing constraints. Add low |
| 2196 | to the current low value and clamp both to any existing high value. |
| 2197 | """ |
| 2198 | if high is not None: |
| 2199 | if self.high_mark is not None: |
| 2200 | self.high_mark = min(self.high_mark, self.low_mark + high) |
| 2201 | else: |
| 2202 | self.high_mark = self.low_mark + high |
| 2203 | if low is not None: |
| 2204 | if self.high_mark is not None: |
| 2205 | self.low_mark = min(self.high_mark, self.low_mark + low) |
| 2206 | else: |
| 2207 | self.low_mark = self.low_mark + low |
| 2208 | |
| 2209 | if self.low_mark == self.high_mark: |
| 2210 | self.set_empty() |
| 2211 | |
| 2212 | def clear_limits(self): |
| 2213 | """Clear any existing limits.""" |
no test coverage detected