- Re-add the force_rebuild key which we need internally again. This
partially reverts changes from:
* cd0000f728
* 1a9b59fcfa
* 93ecd8f72f
- Instead of checking self.completion to figure out whether we need to
rebuild anything, check 'self' (i.e. the History table, not the
CompletionHistory table). If something went wrong during the last
rebuild, the CompletionHistory might still be empty, but History is what
actually matters to figure out whether to rebuild.
- Set force_rebuild while rebuilding the history, so that a possible
interruption of the process (e.g. by a killed process or crash)
results in another rebuild from scratch.
- Bump up the user version again, so that we re-add force_rebuild to the
database. This also forces another rebuild which helps with possible
inconsistent data when someone interrupted the earlier rebuild for
v2.0.0.
Fixes#6111
Makes it clearer what the intent is (rather than implicitly falling back
on __len__ via Python) and also happens to be a small (most probably
insignificant) performance improvement.
On my machine, without a __bool__:
Name (time in us) Min Max Median
test_bool_benchmark 144.2940 879.5960 167.2730
With it:
Name (time in us) Min Max Median
test_bool_benchmark 133.3990 876.1080 152.1879
This renames SqlException to SqlError (to be more consistent with how Python
names exceptions), and adds an utility function which logs a few more useful
details about errors.
See #3004
This allows replace to be a named parameter and allows consolidating
some duplicate code between various insert methods.
This also fixes some tests that broke because batch insert was broken.
This is called often, hopefully a prepared query will speed it up.
This also modifies Query.run to return self for easier chaining, so you
can use `query.run.value()` instead of `query.run` ; query.value()`.
Trying to read from the sql database from another process was flaky.
This adds a debug-dump-history command which is used by the history BDD
tests to validate the history contents.
It outputs history in the old pre-SQL text format, so it might be
useful for those who want to manipulate their history as text.
Turns out historyContains was getting called for the webkit backend multiple
times when the browser starts. This was calling `url in history`, which was
enumerating the entire history as `__contains__` was not defined.
Now that sql is only used for history (not quickmarks/bookmarks) a number of
functions are no longer needed. In addition, primary key support was removed as
we actually need to support multiple entries for the same url with different
access times. The completion model will have to handle this by selecting
something like (url, title, max(atime)).
This also fixes up a number of tests that were broken with the last few
sql-related commits.
Instead of reading sqlite history from a file and storing it in an in-memory
database, just directly use an on-disk database. This resolves#755, where
history entries don't pop in to the completion menu immediately as they are
still being read asynchronously for a few seconds after the browser starts.