* fix: fixture macro attribute
* remove extra new line
* add extra new line
* feat: add test for slqx::test macro
* feat: update test for sqlx::test macro
* remove old macro test
* feat: add postgres and sqlite test
* rust format
* cargo fmt
* fix fixtures execution order in test
* fix(ci): update workflows/examples.yml
* Removed archived `actions-rs` actions
* Upgraded `Swatinem/rust-cache`, `actions/checkout`, `actions/download-artifact`, `actions/upload-artifact`
* chore: deprecate `AnyKind`
* fix: remove dead references to DB features in `sqlx-core`
This reactivates a couple of tests that had stopped working.
* chore(ci): move sqlx-cli checks to their own workflow
* fix(ci): remove remaining `uses: actions-rs/cargo`
* fix warnings
* chore: add titles to sqlx-cli jobs
* fix warnings (2)
* fix error in pool example
* fix warnings (3)
* fix query_builder test
* fix: don't run CLI tests on Windows
* chore: upgrade `rust-toolchain` to 1.80
* fix(postgres): fix missing Tokio specialization in `PgCopyIn`
Caught by the new `unexpected_cfgs` lint.
* fix new warnings
* 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`
* fix: made sure that the json feature is defined for postgres as well
* fixed the feature order
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
---------
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* 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
* fix: make resolve_blocking not take ownership of path
When using sqlx_macros_unstable the codepath taken further uses the path
variable and it is more convenient to not take ownership but instead
pass references to needed functions.
* fix: change &PathBuf to &Path in resolve_blocking
* 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
* HasValueRef, HasArguments, HasStatement -> Database GATs
replace the associated types from the generic traits
`HasValueRef<'r>`, `HasArguments<'q>` and `HasStatement<'q>`
with generic associated types in `Database`
* fixup after rebase
---------
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* Use `create_new` instead of `atomic-file-write`
This provides the same functionality but without temporary files, platform-specific code, fragility of `O_TMPFILE` support, and an extra dependency.
* Properly handle acceptable failure cases
* Consider `PermissionDenied` as acceptable
Apparently this can occur on Windows.
---------
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* 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
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
```
* sqlx-macros-core: Add handling of the 'DATE' pseudo-type in in the sqlite library.
Presently this only functions for the `time` feature, because I don't use the `chrono` feature.
* Update sqlite.rs
Add chrono date support.
* Update sqlite.rs
rustfmt
* Update sqlite.rs
Switch order of time::OffsetDateTime and time::PrimitiveDateTime.
This adds a newline at the end of all cached ./.sqlx/... JSON files so that anyone who has "auto-newline" enabled in their IDE would not accidentally add it to the cached file. This also ensures that GitHub diff would not show an alarming red icon next to the end of the checked in sqlx files.