* CHANGELOG: mention that users should upgrade CLI
* Added regexp support in sqlite
* Added a with_regexp function to sqliteconnectoptions
* Fixed tests
* Undo CHANGELOG.md change
---------
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Co-authored-by: Victor Koenders <victor.koenders@qrtech.se>
* Add tracing dep
* Switch over basic events
* Switch over dynamically enabled events
* Fix missing SocketAddr formatting
* More format fixing
* refactor: Apply tracing changes to new crate structure
* add failing test for nested orderby
* log query paths which were abandoned due to invalid state or looping. Allow instructions to be executed a small number of times to fix nested order by query
* add failing testcase using nested orderby
* fix handling of sequence/offset and rewind
* fix handling when sqlite nests records inside of records
* add test of temporary table handling
* WIP add test failure for temp table access
* fix support for temp tables
* add tests for sqlite datetime functions
* add basic date and time function support
* handle gosub opcode correctly
* add group by test
* fix group by handling
* add additional passing group by test
* add test case for simple limit query
* fix IfPos & If touching wrong branches state, fix IfPos using wrong branch criteria
* add test for large offsets
* add short-circuit for possible query offset loops
* add groupby query that is predicted incorrectly
* fix handling of integer cast failures
* add tests for single-row aggregate results
* fix handling of null-based branching
* add test for coercion of text by sum
* fix calculation of sum value coercion
* add failing test for recursive with query
* add logic for delete operation to fix queries grouping by columns from a recursive query
* feat: Add set_connect_options method to Pool
This allows external updates of the ConnectionOptions used when a new
connection needs to be opened for the pool. The primary use case
is to support dynamically updated (read: rotated) credentials used
by systems like AWS RDS.
* Use Arc wrapper for ConnectOptions to reduce lock contention
* sqlite fix
* Use direct assignment instead of mem::swap
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* add failing test cases for update/delete return into
* fix regression in null tracking by improving tracking of cursor empty/full state
* add failing test case for order by column types
* Add support for SorterOpen,SorterInsert,SorterData
* add failing test case for unions
* fix range copy/move implementation
* fix wrong copy/move range
* remove calls to dbg!
Problem: PgHasArrayType was checking the application's postgres feature
Solution: only check the library's postgres feature
Co-authored-by: Daniel Tashjian <daniel@ecomedes.com>
* fix: ensure migration progress is not lost for PG
Fixes#1966.
* fix: ensure migration progress is not lost for sqlite
This is similar to #1966.
* fix: ensure reverse migration progress is not lost for PG
See #1966.
* fix: ensure reverse migration progress is not lost for sqlite
See #1966.
* fix: ensure migration progress is not lost for mysql
This is similar to #1966.
* fix: ensure reverse migration progress is not lost for mysql
See #1966.
* test: check migration type as well
* test: extend migrations testing
* fix: work around MySQL implicit commits
* refactor: simplify migration testing
Given a generic type like `A<B>` before `sqlx` would produce
`A<B>::from_row(row)` which is invalid syntax.
Now it produces `<A<B> as ::sqlx::FromRow<'a, R>>`.
This also fixes a bug for non-generic types where an inherent method
might have been called instead of the `::sqlx::FromRow::from_row` method
because UFCS wasn't used.
This allows to free server resources earlier and run the same logic as simple Query does:
"The simple Query message is approximately equivalent to the series Parse, Bind, portal Describe, Execute, Close, Sync,"
* Add extension support for SQLite
While SQLite supports loading extensions at run-time via either the C
API or the SQL interface, they strongly recommend [1] only enabling the C
API so that SQL injections don't allow attackers to run arbitrary
extension code.
Here we take the most conservative approach, we enable only the C
function, and then only when the user requests extensions be loaded in
their `SqliteConnectOptions`, and disable it again once we're done
loading those requested modules. We don't add any support for loading
extensions via environment variables or connection strings.
Extensions in the options are stored as an IndexMap as the load order
can have side effects, they will be loaded in the order they are
supplied by the caller.
Extensions with custom entry points are supported, but a default API
is exposed as most users will interact with extensions using the
defaults.
[1]: https://sqlite.org/c3ref/enable_load_extension.html
* Add extension testing for SQlite
Extends x.py to download an appropriate shared object file for supported
operating systems, and uses wget to fetch one into the GitHub Actions
context for use by CI.
Overriding LD_LIBRARY_PATH for only this specific DB minimises the
impact on the rest of the suite.
* Separate offline query metadata per crate
* Update sqlx-cli prepare to use separate query metadata per crate
* Add resolve.root to metadata test fixture
* Simplify root package resolution
* Fix prepare --merged
@danielakhterov and I were playing around with counting lines using regex and noticed that SQLx had an odd number of ` ``` ` and got a little nerd-sniped trying to find it.
When the `#[sqlx::test]` macro is imported using `#[macro_use]` such as
in the following example:
```rust
extern crate sqlx;
mod tests {
#[test]
fn something() {}
}
```
then the `#[test]` generated by the macro will refer to itself instead
of the standard Rust `#[test]` macro. This will cause `rustc` to
recursively expand it and produce the following error message:
```
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
```
Instead, we can just refer to the standard macro by using its fully
qualified path.
This PR:
* Swaps `#[test]` usages in `#[sqlx::test]` for their hygenic path to
prevent recursive expansion alongside `#[macro_use]`
Closes#2017.