Commit Graph

3635 Commits

Author SHA1 Message Date
Damien Elmes
c723adea17 fix escape handling, and handle sql wildcards 2020-03-20 21:15:23 +10:00
Damien Elmes
b70668d31c avoid extra sql binding in unqualified search 2020-03-20 21:15:23 +10:00
Damien Elmes
1f9e8e388a start on search tests 2020-03-20 21:15:23 +10:00
Damien Elmes
bca5f2ddff prototype of integration
no ordering yet, and no tests
2020-03-20 21:15:23 +10:00
Damien Elmes
9752de5aaa finish the remaining searches
Searches that require multiple deck or note type lookups won't perform
very well at the moment - it either needs caching or to be split up
at the DB level.

Nothing tested yet.
2020-03-20 21:15:23 +10:00
Damien Elmes
85af35509d ctx->req 2020-03-20 21:15:23 +10:00
Damien Elmes
dc12c23ce9 add timing to search 2020-03-20 21:15:23 +10:00
Damien Elmes
2beccd377b add v1 and v2 legacy timing code 2020-03-20 21:15:23 +10:00
Damien Elmes
9f3cc0982d deck searching
A bit more complicated than it needs to be, as we don't have the
full deck manager infrastructure yet.
2020-03-20 21:15:23 +10:00
Damien Elmes
f559ae3ef8 address some clippy lints 2020-03-20 21:15:23 +10:00
Damien Elmes
cc54e92756 move html stripping out of field_checksum into caller 2020-03-20 21:15:23 +10:00
Damien Elmes
7eab504126 add field_at_index() sql func 2020-03-20 21:15:23 +10:00
Damien Elmes
cffa52ff82 more searching work 2020-03-20 21:15:23 +10:00
Damien Elmes
761d1d1812 add card queue/type enums 2020-03-20 21:15:23 +10:00
Damien Elmes
91d7b02325 separate out template ordinal and name search 2020-03-20 21:15:23 +10:00
Damien Elmes
dcb2b46d1b use .eq_ignore_ascii_case() to avoid allocating 2020-03-20 21:15:23 +10:00
Damien Elmes
68657c7166 field_checksum needs to strip HTML 2020-03-20 21:15:23 +10:00
Damien Elmes
4f93ae4b6d start of searching sql 2020-03-20 21:15:23 +10:00
Damien Elmes
00300bb24d ensure rated ease in range 2020-03-20 21:15:23 +10:00
Damien Elmes
e790367b1e ensure id list not empty 2020-03-20 21:15:23 +10:00
Damien Elmes
08d205d377 decode search terms in parser 2020-03-20 21:15:23 +10:00
Damien Elmes
289318d92c split up searches with a qualifier 2020-03-20 21:15:23 +10:00
Damien Elmes
f623f19b3d basic search parsing 2020-03-20 21:15:23 +10:00
Damien Elmes
794c8a984b add string about waiting for completion 2020-03-20 21:15:23 +10:00
Damien Elmes
55c9f5dbeb wait for media sync to complete before unloading collection 2020-03-20 21:15:23 +10:00
Damien Elmes
72bcef917e release mutex before beginning media sync
And check media sync is not running on close
2020-03-20 21:15:23 +10:00
Damien Elmes
5f19048c93 fix media sync being logged to console 2020-03-20 21:15:23 +10:00
Damien Elmes
d7daa63dbd make sure we set db to None so we can tell when we've closed the DB 2020-03-20 21:15:23 +10:00
Damien Elmes
d03e13a1bd reuse the existing backend instead of creating a new one 2020-03-20 21:15:23 +10:00
Damien Elmes
ba17567617 drop the separate i18n backend 2020-03-20 21:15:23 +10:00
Damien Elmes
874bc085fe support opening and closing the DB while keeping backend alive
This is safer than just dropping the backend, as .close() will
block if something else is holding the mutex. Also means we can
drop the extra I18nBackend code.

Media syncing still needs fixing.
2020-03-20 21:15:23 +10:00
Damien Elmes
94e4c40ebf move media folder/db paths into collection
this breaks background media syncing for now
2020-03-20 21:15:23 +10:00
Damien Elmes
649b40371b drop unused col_path 2020-03-20 21:15:23 +10:00
Damien Elmes
1322d8c617 make the collection optional 2020-03-20 21:15:23 +10:00
Damien Elmes
d0d6aa1433 drop usage of flushSched() 2020-03-20 21:15:23 +10:00
Damien Elmes
8d429cd192 import .colpkg in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
ad9dad8748 import .apkg files in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
231fa30a86 import mapped files like csv in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
53952ba131 export in a background thread 2020-03-20 21:15:23 +10:00
Damien Elmes
7986a79530 remove db.close() 2020-03-20 21:15:23 +10:00
Damien Elmes
fa12213e98 move .reopen() to mw; fix exporting 2020-03-20 21:15:23 +10:00
Damien Elmes
fe59d11047 fix mypy warning 2020-03-20 21:15:23 +10:00
Damien Elmes
0f38514ad7 drop the DB progress handler code
This code was an awful hack to provide some semblance of UI
responsiveness while executing DB statements on the main thread.
Instead, we can just run DB statements in a background thread now,
keeping the UI responsive.
2020-03-20 21:15:23 +10:00
Damien Elmes
90d4d62c48 use a timer to automatically show progress window
We were previously relying on the DB progress hook to cause the
progress window to display.

Qt's progress dialogs do have built in support for automatically
showing, but it's easier to add a timer than change the existing
code to use it.
2020-03-20 21:15:23 +10:00
Damien Elmes
32555b2857 run Check DB in a background thread
Since the DB is now stored behind a mutex, we're no longer limited
to accessing the database on the main thread.
2020-03-20 21:15:23 +10:00
Damien Elmes
daaf8bdc70 release the GIL during a DB request 2020-03-20 21:15:23 +10:00
Damien Elmes
90de4a267d drop lock() and setAutocommit()
We no longer need to worry about pysqlite implicitly beginning
transactions, and can be more explicit about beginning/ending
transactions

save() now also has a trx argument controlling whether a
transaction should be started / left open
2020-03-20 21:15:23 +10:00
Damien Elmes
63e3357068 pass weakref in from storage to fix type checking/code completion 2020-03-20 21:15:23 +10:00
Damien Elmes
db1508e27c support first_row_only 2020-03-20 21:15:23 +10:00
Damien Elmes
e14c5e4745 proper implementation of executemany(); drop executescript() 2020-03-20 21:15:23 +10:00