-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve internal sql interface
* refactor: move sql into own mod * refactor: resultify sql interface * fixup * start usage of sqlx * compile again * migrate exists * migrate query_row and query_row_optional * migrate table_exists * migrate with_conn * migrate rowid * migrate most of query_map * finish query_map migration * remove rusqlite and fixup examples * improve migrations and ensure closing * fix rust tests * wip * fixup rebase and get things to compile * start fixing tests * use sqlx fork * debugging * fix receive imf insert * fix message loading * fix grpid bug * exists() expects COUNT() in sql-statement * fix two more exists() statements * fix test_audit_log_view_without_daymarker * Fix clippy warnings * fix test_fetch_existing dc_get_config() must never return NULL, instead return "" * ffi: make render_info accept non-option BTreeMap * fix a typo * Restore changes from PR #2258 They have been accidentally reverted during sqlx rebasing * Remove useless cast that was not there before switch to sqlx * Split long query into several lines so rustfmt does not fail * Remove outdated comment DC_CONTACT_ID_SELF is bound into the query now. * Split long lines to make rustfmt work * Restore accidentally removed part of PR #2132 * Make rustfmt work * Use exists() instead of count() in is_group_explicitly_left * Make rustfmt work * Fix a typo ("foreing") * Fix rustfmt * Fix formatting * Replace 0x100 constant with Origin::IncomingReplyTo * Replace constant 100 with Chattype::Single * Remove commented out code * peerstate: make rustfmt work * Move the code to make msg immutable * do not re-use bind parameters sqlx does not bind the first `?` implicitly to `?1`, therefore the sql-statement fails. we could use `?1` several times, however, i did not find good documentation about that, and even if that works now, that could fail with other db or even with sqlite in newer versions. therefore, we just bind every parameter explicitly. * Do not use read only sqlite mode * Factor out database pool creation * Open reader pool in readonly mode if database is opened in readonly mode * Add a test for reopening the database * sql::table_exists: drain response stream to avoid breaking connection * Drain the stream in Sql.col_exists * sqlx: fix failing TestOnlineAccount::test_saved_mime_on_received_message (#2323) * add failing tests for save_mime_headers * fix saving mime if an encrypted message is received, and we do not have the decoded data, for whatever reason, save the raw data. * let dc_get_mime_headers return NULL on empty string * let test_save_mime_headers_*() tests return anyhow::Result<()> * make clippy happy * Remove 5 unwraps * Remove another unwrap * Replace {:?} with {:#} for error handling * Remove all dbg! statements * set max_connections=10 (default), show num_cpus in get_info() setting the number of connections to the number of cpus seems to be to low in general: - on a mac i5 from 2017, that would result in 4 connections - on an iphone7, that would result in only 2 connections the sqlx-default is 10 connections, so, this pr uses that default (plus 1 connection for the writer tag). on the iphone7, that change was directly noticable - sqlx with 2 connections feelt not much faster that rusqlite with 10 connections, however, using sqlx with the 10+1 connection was a real boost, at least at a first glance :) might be, fewer connections would be sufficient as well, however, i do not see much reasons not to go with the default here. * Disable sqlx statement cache This is a workaround for launchbadge/sqlx#1147 Draining statement results is no longer needed. * Make clippy happy * Do not pass NULL to mime_headers column nor expect it from there. Treat existing NULL as "empty string". * Increase SQL busy timeout to 100 seconds No need to abort the connection if all connections are stalled for 10 seconds. This did not happen, just to make sure each timeout is a result of an actual deadlock. * README: specify log target to get rid of sqlx query logging * Remove 3 unwrap()'s * Remove two more unwrap()'s Co-authored-by: B. Petersen <r10s@b44t.com> Co-authored-by: Hocuri <hocuri@gmx.de> Co-authored-by: link2xt <link2xt@testrun.org>
- Loading branch information
1 parent
4dedc2d
commit 54db9a7
Showing
52 changed files
with
5,503 additions
and
4,981 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.