* add explicit shutdown of sqlite statement worker in Connection::close()
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
* test sqlite database close method
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
* await worker shutdown after dropping SqliteConnection
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
* restore explicit drop
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
* fix: wait until ready after executing other helper queries while pg quering is executing
Signed-off-by: Atkins Chang <atkinschang@gmail.com>
* fix: use tls parameter for testing target
Signed-off-by: Atkins Chang <atkinschang@gmail.com>
* sqlite: use Arc instead of Copy-able StatementHandle
This guarantees that StatementHandle is never used after calling
`sqlite3_finalize`. Now `sqlite3_finalize` is only called when
StatementHandle is dropped.
(cherry picked from commit 5eebc05dc3)
* sqlite: use Weak poiter to StatementHandle in the worker
Otherwise some tests fail to close connection.
(cherry picked from commit 5461eeeee3)
* Fix segfault due to race condition in sqlite (#1300)
(cherry picked from commit bb62cf767e)
* fix(sqlite): run `sqlite3_reset()` in `StatementWorker`
this avoids possible race conditions without using a mutex
* fix(sqlite): have `StatementWorker` keep a strong ref to `ConnectionHandle`
this should prevent the database handle from being finalized before all statement handles
have been finalized
* fix(sqlite/test): make `concurrent_resets_dont_segfault` runtime-agnostic
Co-authored-by: link2xt <link2xt@testrun.org>
Co-authored-by: Adam Cigánek <adam.ciganek@gmail.com>
* fix(macros): tell the compiler about external files/env vars to watch
closes#663closes#681
* feat(cli): add `migrate` subcommand for generating a build script
suggest embedding migrations on `sqlx migrate add` in a new project
* a task that is marked woken but didn't actually wake before being cancelled will instead wake the next task in the queue
* a task that wakes but doesn't get a connection will put itself back in the queue instead of waiting until it times out with no way to be woken
* the idle reaper now won't run if there are tasks waiting for a connection, and also uses
the proper `SharedPool::release()` to return validated connections to the pool so waiting tasks get woken
closes#622, #1210
(hopefully for good this time)
Signed-off-by: Austin Bonander <austin@launchbadge.com>
Unlike `Executor.fetch_optional()`, `Executor.fetch_many()` does not
have a single exit. The stream can be dropped at any time. To catch
this event, we create a `StatementResetter` structure inside the stream
loop and reset the statement when it is dropped.
A test case `it_resets_prepared_statement_after_fetch_many` is
similar to `it_resets_prepared_statement_after_fetch_one` which tests
`Executor.fetch_optional()`.
* fix `DecrementSizeGuard::drop()` only waking one `Waiter` regardless of whether that waiter was already woken
* fix connect-backoff loop giving up the size guard
* don't cut in line to open a new connection
* have tasks waiting on `acquire()` wake periodically to check if there's a connection in the queue
Signed-off-by: Austin Bonander <austin@launchbadge.com>
Fix commit updates the `postgres::connection::describe` module to add full support for domain types. Domain types were previously confused with their category which caused invalid oid resolution.
Fixeslaunchbadge/sqlx#110
BREAKING CHANGE: some columns in `query!()` et. al. output will change from `T` to `Option<T>`
breakage should be minimal in practice as
these columns will need to have been manually
overridden anyway to avoid runtime errors
Signed-off-by: Austin Bonander <austin@launchbadge.com>