Commit graph

25 commits

Author SHA1 Message Date
Damien Elmes
4f5fc9a63d move storage logic into collection.py; fix export bug
https://anki.tenderapp.com/discussions/ankidesktop/41495-using-file-export-closes-the-collection-on-mwcoldb-if-the-browser-window-is-open
2020-05-20 17:43:34 +10:00
Damien Elmes
120dd7fc03 fetch/set remaining collection properties as required 2020-05-15 13:33:37 +10:00
Damien Elmes
d777abfa4a emulate named args 2020-04-06 20:09:44 +10:00
Damien Elmes
602d6b00c2 remove : check from dbproxy 2020-03-24 10:37:12 +10:00
Damien Elmes
e53ee52d2a remove db.close() 2020-03-20 21:15:23 +10:00
Damien Elmes
a02c4ed994 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
8cb3ed7435 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
3256c74409 pass weakref in from storage to fix type checking/code completion 2020-03-20 21:15:23 +10:00
Damien Elmes
116f7fa3f1 support first_row_only 2020-03-20 21:15:23 +10:00
Damien Elmes
7e5f713f05 proper implementation of executemany(); drop executescript() 2020-03-20 21:15:23 +10:00
Damien Elmes
3f3a45e2ba add Collection struct, and get media check working again
- media check no longer needs collection to be closed
- use savepoints for operations initiated by Rust, so they are
atomic without forcing a commit
2020-03-20 21:15:23 +10:00
Damien Elmes
700d713f80 add begin/commit/rollback, and support creating collections
all but one unit test is now passing
2020-03-20 21:15:23 +10:00
Damien Elmes
d42df6e0f1 add a temporary executemany() 2020-03-20 21:15:23 +10:00
Damien Elmes
bd7ded18c3 drop the protobuf prototype 2020-03-20 21:15:23 +10:00
Damien Elmes
38d4ea5311 use (or)json for DB bridge
Some initial testing with orjson indicates performance varies from
slightly better than pysqlite to about 2x slower depending on the type
of query.

Performance could be improved by building the Python list in rspy
instead of sending back json that needs to be decoded, but it may make
more sense to rewrite the hotspots in Rust instead. More testing is
required in any case.
2020-03-20 21:15:23 +10:00
Damien Elmes
1db876ba1c tweak db type hints 2020-03-20 21:15:23 +10:00
Damien Elmes
7fbc229dcd drop usage of pysqlite Cursor 2020-03-20 21:15:23 +10:00
Damien Elmes
e5a465cccb tweak layout of db methods 2020-03-20 21:15:23 +10:00
Damien Elmes
7bf27febe6 drop .cursor() 2020-03-20 21:15:23 +10:00
Damien Elmes
fb9db72dde use total_changes() sqlite func 2020-03-20 21:15:23 +10:00
Damien Elmes
fcfe1bd66c drop context manager 2020-03-20 21:15:23 +10:00
Damien Elmes
9e67ea736a drop named sql arguments 2020-03-20 21:15:23 +10:00
Damien Elmes
6d0c84a1e9 drop progress handler and timeout arg 2020-03-20 21:15:23 +10:00
Damien Elmes
45399df30d drop echo and text factory 2020-03-20 21:15:23 +10:00
Damien Elmes
923d85f66b clone db.py into dbproxy.py 2020-03-20 21:15:23 +10:00