Kenneth Skovhede
179d1ceb47
Make controller Async
...
This PR has a large blast radius because it takes the final step and bumps up the Controller to be fully async.
We have historically done a piece-by-piece update, so all operations were already async but the controller interface was kept synchronous.
With this update, the controller is now fully async and all tests are updated.
Most places where the new C# compiler warns about function names not ending in `Async` were also adressed, giving a massive refactor change.
Functionally, no changes are done.
2026-05-13 15:04:13 +02:00
Kenneth Skovhede
308e8428c7
Add slow query monitor
...
When queries are slow on end-user machines it is hard to debug what the exact problem is.
The typical flow is to discover a "stuck" process. But since profiling logging was not enabled there is no output.
The user then has to re-run the problematic operation with profiling on, and locate the last output where the call gets stuck.
This PR introducces a monitor mechanism where all queries register themselves prior to execution, and then de-register once done.
At a fixed interval, the list of active queries is examined, and if a query is found to be running longer than the threshold, it will be logged as a warning.
This means the user can simply go view the live log for warnings, and the offending query will be emitted.
The default threshold is set at a conservative 30 minutes. Since the timer only checks at the interval, it can take at most 2x the interval before a message is logged. After this, a message is logged each time the interval is reached (e.g., a new warning is logged every 30 min).
The option `--long-database-query-threshold` can be used to set a different threshold.
2026-05-08 10:30:47 +02:00
Kenneth Skovhede
c0f40e19ca
Updated copyright year to 2026 across the project
2026-04-16 15:21:24 +02:00
Carl Johnsen
8c022b63dc
Replacement strings for Regex.Replace cannot contain dollar signs followed by a number, as that is also being parsed.
2026-03-25 13:42:32 +01:00
Kenneth Skovhede
39cca5c24f
Simplified calling code to not rely on extension methods
2025-09-25 11:33:56 +02:00
Kenneth Skovhede
230d80642a
Fixed invariant formatting helpers
...
This fixes an issue with formatting for invariant values that was caused by incrorrect function overload selection.
To avoid future issues, the two similar functions have been renamed to clarify what they are working for.
2025-09-25 11:14:54 +02:00
Kenneth Skovhede
b2c6ef73c5
Improve logging of SQL statements
...
This updates the logging code to do invariant formatting of the SQL statements
2025-09-22 14:39:46 +02:00
Carl Johnsen
7670ea9a58
Ensured that all values that are passed to interpolation strings have been passed through FormatInvariant to prevent SQLite errors related to string formatting cultures.
2025-09-05 14:11:05 +02:00
Kenneth Skovhede
cb89572ef8
Setting DBNull.Value for null values
2025-07-07 17:04:07 +02:00
Carl Johnsen
7c425c4649
Added some extra overloads to the async database extension methods
2025-06-19 08:08:17 +02:00
Carl Johnsen
da57bbae33
Made the TemporaryDbValueList methods accept a cancellation token
2025-06-18 14:21:57 +02:00
Carl Johnsen
b9555cdcd4
Made all the async database extension methods accept a cancellation token
2025-06-18 14:21:35 +02:00
Carl Johnsen
9ac583db94
Made all relevant using statements use await to use DisposeAsync
2025-06-18 11:53:11 +02:00
Carl Johnsen
e81100de04
Started on adding docstrings
2025-06-17 09:59:22 +02:00
Carl Johnsen
3d11a05400
Added .ConfigureAwait(false) to all of the await statements
2025-06-12 08:34:29 +02:00
Carl Johnsen
da9334d174
Made ExpandInClaseParameterMssqlite generic to avoid casting
2025-06-11 11:07:41 +02:00
Carl Johnsen
f373880c5a
Renamed ExpandInClauseParameterAsync, as one of them isn't actually async.
...
Postfix mssqlite has been added as well to not clash with the IDb implementation
2025-06-11 10:47:40 +02:00
Carl Johnsen
9c2252f36c
Ensured common order and interface for the async extension methods.
2025-06-11 10:46:04 +02:00
Carl Johnsen
1db0fc7789
Reordered the call trace of ExecuteScalarInt64Async
2025-06-11 10:06:55 +02:00
Carl Johnsen
bbe409d564
Reordered the call trace of ExecuteScalarAsync
2025-06-11 10:01:40 +02:00
Carl Johnsen
16fdb633be
Reordered the call trace of ExecuteReaderEnumerableAsync
2025-06-11 09:52:45 +02:00
Carl Johnsen
544ec85d87
Added missing combination of parameters to ExecuterReaderAsync
2025-06-11 09:48:09 +02:00
Carl Johnsen
7c9516eea0
Reordered the call trace of ExecuteNonQueryAsync
2025-06-11 09:42:51 +02:00
Carl Johnsen
1ab303caea
Reordered the call trace of ExecuteReaderAsync
2025-06-11 09:34:50 +02:00
Carl Johnsen
c1710cd6a4
Updated the database helper method for formatting SQL queries for logging
2025-06-11 09:33:30 +02:00
Carl Johnsen
e946b3593a
Handled TODOs in the database extension methods
2025-06-11 09:32:28 +02:00
Carl Johnsen
d78d7c2739
Added additional logging of SQL executions
2025-06-04 09:11:34 +02:00
Carl Johnsen
abcb3569ff
Added additional logging of SQL executions
2025-06-03 21:46:50 +02:00
Carl Johnsen
344d3dcb5b
The new backend requires a value to be set
2025-05-22 15:28:14 +02:00
Carl Johnsen
2cd1692532
Temporary fix to distinguish between new and legacy extension method
2025-05-22 13:25:42 +02:00
Carl Johnsen
21a9f0036c
Reintroduced legacy database methods for non-main operation calls to be able to function.
2025-05-22 13:23:27 +02:00
Carl Johnsen
75c77bdaa6
Fixed async method not being async
2025-05-20 07:08:01 +02:00
Carl Johnsen
c848ca6819
Added more extension methods as they're required by LocalBackupDatabase
2025-05-19 15:43:21 +02:00
Carl Johnsen
ae12d63468
Changed TemporaryDbValueList to use factory construction and to be proper async.
2025-05-19 14:27:01 +02:00
Carl Johnsen
d4c56ec9ef
Changed TemporaryDbValueList from IDb to Microsoft.Data.Sqlite
2025-05-19 13:49:14 +02:00
Carl Johnsen
ab6b2a64c9
Added the extension method to pass ReusableTransactions directly on SqliteCommands
2025-05-19 10:37:37 +02:00
Carl Johnsen
2de3f1d5b5
Reintroduced the synchronous CreateCommand extension method
2025-05-16 12:38:02 +02:00
Carl Johnsen
84b50e5db8
Added the SetTransaction extension method.
...
The main use is to ensure that the given transaction parameter is not null.
Maybe it will be performing more checks in the future.
2025-05-16 12:23:46 +02:00
Carl Johnsen
6782597791
Moved FormatInvariant to inner function and restructured chain of calls when executing commands.
2025-05-16 12:21:56 +02:00
Carl Johnsen
2817f05c93
First WIP changes to extension methods
2025-05-16 12:21:56 +02:00
Carl Johnsen
e00218feb6
Removed whitespace
2025-05-16 12:21:56 +02:00
Kenneth Skovhede
c3fe98c09c
Disable the begin immediate as it seems the library does it automatically
2025-04-14 22:57:44 +02:00
Kenneth Skovhede
faede65d8d
Changed transactions to use a wrapper that ensures a transaction is allocated.
2025-04-14 12:04:00 +02:00
Kenneth Skovhede
35682bd4fe
Cleaned up some nullability issues
2025-04-03 14:20:00 +02:00
Kenneth Skovhede
e96e769ba6
Removed support for positional arguments in extension methods
2025-04-03 13:59:39 +02:00
Kenneth Skovhede
9e3aa72d00
Added LocalBackupDatabase
2025-04-03 11:31:36 +02:00
Kenneth Skovhede
7b948a2f1d
Fixed issue with SQLite bindings not supporting arrays.
...
Added helper class to wrap values in a temporary table if they exceeed the maximum number of parameters.
2025-04-02 23:26:20 +02:00
Kenneth Skovhede
53a1d2a723
Added LocalListBrokenFilesDatabase
2025-04-02 14:06:06 +02:00
Kenneth Skovhede
bf1ef0e794
Fixed nullability warnings
2025-03-24 10:31:52 +01:00
Kenneth Skovhede
fe1cef3be8
Move away from positional parameters in SQL statements.
...
This is a move away from using positional parameters in SQL statements and rok towards only using named parameters.
2025-03-18 22:41:11 +01:00