Show More
@@ -290,7 +290,7 b' class HistoryAccessor(Configurable):' | |||
|
290 | 290 | return reversed(list(cur)) |
|
291 | 291 | |
|
292 | 292 | def search(self, pattern="*", raw=True, search_raw=True, |
|
293 | output=False): | |
|
293 | output=False, n=None): | |
|
294 | 294 | """Search the database using unix glob-style matching (wildcards |
|
295 | 295 | * and ?). |
|
296 | 296 | |
@@ -302,6 +302,9 b' class HistoryAccessor(Configurable):' | |||
|
302 | 302 | If True, search the raw input, otherwise, the parsed input |
|
303 | 303 | raw, output : bool |
|
304 | 304 | See :meth:`get_range` |
|
305 | n : None or int | |
|
306 | If an integer is given, it defines the limit of | |
|
307 | returned entries. | |
|
305 | 308 | |
|
306 | 309 | Returns |
|
307 | 310 | ------- |
@@ -311,9 +314,16 b' class HistoryAccessor(Configurable):' | |||
|
311 | 314 | if output: |
|
312 | 315 | tosearch = "history." + tosearch |
|
313 | 316 | self.writeout_cache() |
|
314 |
|
|
|
315 | raw=raw, output=output) | |
|
316 | ||
|
317 | sqlform = "WHERE %s GLOB ?" % tosearch | |
|
318 | params = (pattern,) | |
|
319 | if n is not None: | |
|
320 | sqlform += " ORDER BY session DESC, line DESC LIMIT ?" | |
|
321 | params += (n,) | |
|
322 | cur = self._run_sql(sqlform, params, raw=raw, output=output) | |
|
323 | if n is not None: | |
|
324 | cur = iter(reversed(list(cur))) | |
|
325 | return cur | |
|
326 | ||
|
317 | 327 | def get_range(self, session, start=1, stop=None, raw=True,output=False): |
|
318 | 328 | """Retrieve input by session. |
|
319 | 329 |
General Comments 0
You need to be logged in to leave comments.
Login now