* chore: create regression test for #3344
* fix(derives): use a parameter name that's less likely to collide
* breaking(derives): emit `Error::ColumnDecode` when a `TryFrom` conversion fails in `FromRow`
Breaking because `#[sqlx(default)]` on an individual field or the struct itself would have previously suppressed the error. This doesn't seem like good behavior as it could result in some potentially very difficult bugs.
Instead of using `TryFrom` for these fields, just implement `From` and apply the default explicitly.
* fix: run `cargo fmt`
* fix: use correct field in `ColumnDecode`
* feat: add cube
* docs: cube docs
* docs: update readme
* fix: cube is now not feature flagged
* fix: formatting
* fix: typeo for PgCube vs Cube
* fix: correct types
* fix: postgres only types for cube
* fix: cube readme
* fix: dont unwrap cubes
* fix: typo on interval
* fix: zero volume cube array
* fix: return type
* fix: update tests
* fix: run with one test type
* fix: log bytes in error
* fix: typo in test
* fix: log bytes for failed length
* fix: string deser
* docs: remove cube from readme
* fix: int to float
* fix: trim floats
* fix: exttra test
* fix: type safe into vectors
* fix: improve error messages
* docs: remove comments
* fix: front load most important logic and const at start
* fix: extract constants
* fix: flags
* fix: avoid redundant buffer creation and use FromStr trait
* fix: handle serializing
* test: cube vec test
* fix: no array cube test
* fix: update test with array for cube
* fix: dont use try from for u8
* fix: conditionally remove padding
* fix: conditional trimming
* fix: idiomatic trimming
* fix: linting
* fix: remove whitespace
* fix: lower case array
* fix: spacing input
* test: one more vec test
* fix: trim square brackets in case they are using postgres spec page
* fix: result types
* fix: format
* fix: box error
* fix: the borrow produces a value
* fix: self serialise
* chore: merge main
* fix: borrow
* fix: clippy
---------
Co-authored-by: James Holman <james.holman@betashares.com.au>
* feat: Add set_update_hook on SqliteConnection
* refactor: Address PR comments
* fix: Expose UpdateHookResult for public use
---------
Co-authored-by: John Smith <asserta4@gmail.com>
* convert logger to output a query graph
* avoid duplicating branch paths to shrink output graph
* separate different branching paths
* include all branches which found unique states
* track the reason for ending each branches execution
* track the result type of each branch
* make edges rely on history index instead of program_id, to avoid errors when looping
* add state diff to query graph
* drop redundant table info
* rework graph to show state changes, rework logger to store state snapshots
* show state on the previous operation
* gather duplicate state changes into clusters to reduce repetition
* draw invisible connections between unknown instructions by program_i
* clean up dot format string escaping
* add test case from #1960 (update returning all columns)
* add tests for #2939 (update returning only the PK column)
* allow inserting into a table using only the index
* improve null handling of IfNull, fix output type of NewRowId
* add NoResult nodes for branches which don't log a result, as a sanity check
* add short-circuit to all logging operations
* remove duplicate logging checks, and make logging enabled/disabled consistently depend on sqlx::explain instead of sqlx for capture & sqlx::explain for output
* add failing test for awkwardly nested/filtered count subquery
* handle special case of return operation to fix failing test
* require trace log level instead of using whatever log level statement logging was configured to use
* Make encode and encode_by_ref fallible
This only changes the trait for now and makes it compile, calling .expect() on all users. Those will be removed in a later commit.
* PgNumeric: Turn TryFrom Decimal to an infallible From
* Turn panics in Encode implementations into errors
* Add Encode error analogous to the Decode error
* Propagate decode errors through Arguments::add
This pushes the panics one level further to mostly bind calls. Those will also be removed later.
* Only check argument encoding at the end
* Use Result in Query internally
* Implement query_with functions in terms of _with_result
* Surface encode errors when executing a query.
* Remove remaining panics in AnyConnectionBackend implementations
* PostgreSQL BigDecimal: Return encode error immediately
* Arguments: Add len method to report how many arguments were added
* Query::bind: Report which argument failed to encode
* IsNull: Add is_null method
* MySqlArguments: Replace manual bitmap code with NullBitMap helper type
* Roll back buffer in MySqlArguments if encoding fails
* Roll back buffer in SqliteArguments if encoding fails
* Roll back PgArgumentBuffer if encoding fails
* Include test case for regular subtransactions
While using COPY and subtransactions I kept running into errors.
This test case documents that error, it currently fails with:
Error: encountered unexpected or invalid data: expecting ParseComplete but received CommandComplete
* PostgreSQL Copy: Consume ReadyForQuery on error
When a COPY statement was in error inside a subtransaction,
a Protocol Error used to be raised. By consuming the ReadyForQuery
message when there is an error, we no longer have this issue.
* test: add a failing test
* feat: add no_tx to migration struct
* feat: execute migration with no tx block
* fix: expected string literal compilation error
* test: update no tx to content comment
* refactor: use the sql comment instead of file name semantics
* docs: remove no_tx from file format comment
* fix: remove filename matches
* fix: messed up merge
* refactor: dedupe migration
* fix: move comment to where it makes sense
* fix: linter error
Breaking changes:
* integer decoding will now loudly error on overflow instead of silently truncating.
* some usages of the query!() macros might change an i32 to an i64.
Also adds support for *decoding* `u64`s because there's no reason not to.
Closes#3179
Also clarifies the handling of `TIME` (we never realized it's used for both time-of-day and signed intervals) and adds appropriate impls for `std::time::Duration`, `time::Duration`, `chrono::TimeDelta`
This is meant to be much easier to discover than the current approach of directly invoking `Executor` methods.
In addition, I'm improving documentation for the `query*()` functions across the board.
* feat: add fixtures_path
* test: add test for fixtures_path
* docs: expand test docs with fixtures_path
* test: add new test instead of co-opting and old one.
* feat: add explicit path operating mode for fixtures parameters and allow combining multiple fixtures parameters
* fix: require .sql extension for explicit path fixtures
* feat: add custom relative path style to fixtures argument
* fix: missing cfg feature
* docs: update
* fix: explicit fixtures styling checks for paths. Remove strict sql extension requirement for explicit path, they still need an extension. Add .sql extension to implicit fixtures style only if missing.
* style: cargo fmt
* docs: update documentation
* chore:Added ipaddr extension library to gitignore
* fix:In a Linux environment, shared libraries in the current directory are not loaded, so add the current directory to the LD_LIBRARY_PATH environment variable.
* fix: Since confrict primary key when running multiple sqlite tests, removed specific primary key in insert.
* chore: Since avoid git modified targeting, copy the db file to new test db file.
* fix: Since docker mysql 5.7 using yaSSL(It only supports TLSv1.1), avoid running when using rustls.
* feat(citext): implement citext for postgres
* feat(citext): add citext -> String conversion test
* feat(citext): fix ltree -> citree
* feat(citext): add citext to the setup.sql
* chore: address nits to #2478
* Rename `PgCitext` to `PgCiText`
* Document when use of `PgCiText` is warranted
* Document potentially surprising `PartialEq` behavior
* Test that the macros consider `CITEXT` to be compatible with `String` and friends
* doc: add `PgCiText` to `postgres::types` listing
* chore: restore missing trailing line break to `tests/postgres/setup.sql`
---------
Co-authored-by: Austin Bonander <austin@launchbadge.com>
With MariaDB 10.3 EOL it seems prudent to include
the latest 10.11 LTS release in the CI tests.
To catch #1664 sort of issues prior to release, add
a container image test for mariadb that contains the
finished pre-release code changes (and container changes)
to ensure that compatibilty is maintianed. When
server code hits the branch associated with this tag
it is considered finished by its server developers and
has passes CI so no regressions are expected, but
it wouldn't hurt to have CI in other systems testing
it too.
Since MySQL has fixed the regression that caused #1664
this puts it back to their 8.0 release tag.
Append the :z tag to the docker compose volume mounts
so on selinux systems enough permissions occur for the
volume to be able to read the volume contents.
* fix(postgres): sqlx prepare fails if shared_preload_libraries=pg_stat_statements
closes#2622
refs:
* https://serde.rs/enum-representations.html#untagged
* https://serde.rs/field-attrs.html#skip
* https://www.postgresql.org/docs/current/pgstatstatements.html
* https://www.postgresql.org/docs/current/runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID
* fix(postgres): regression of #1449
```
error: error occurred while decoding column 0: data did not match any variant of untagged enum Explain at line 3 column 1
Error: --> tests/postgres/macros.rs:103:15
|
103 | let row = sqlx::query!(r#"CALL forty_two(null)"#)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `sqlx` (test "postgres-macros") due to previous error
```
* refactor(postgres): don't define unused fields in QueryPlan
* refactor(postgres): simplify query plan handling, add unit test
* chore: document why we load `pg_stat_statements` in tests
---------
Co-authored-by: mrl5 <31549762+mrl5@users.noreply.github.com>
Inlined format args make code more readable, and code more compact.
I ran this clippy command to fix most cases, and then cleaned up a few trailing commas and uncaught edge cases.
```
cargo clippy --bins --examples --benches --tests --lib --workspace --fix -- -A clippy::all -W clippy::uninlined_format_args
```
* Traverse symlinks when resolving migrations
When enumerating the source directory seeking migration files, `sqlx`
ignores entries that aren't files. This was previously reported as #614
and fixed in #985 but apparently regressed somewhere along the way. This
commit reintroduces the fix from #985 to the current implementation: use
`std::fs::metadata` instead of `std::fs::DirEntry::metadata`. The former
is documented to traverse symlinks; the latter does not.
* add migrations_symlink test
* Add failing tests
* remove unnecessary functions, clarify function names
* simplify access to cursor columns with helper methods
* split table info from cursor info so that cursors can share table info
* fix test expectations