Commit graph

2274 commits

Author SHA1 Message Date
kryptan
ca608a964e
Clarify where optional features should be enabled (#2706) 2023-09-21 17:49:51 -07:00
Adam Cigánek
c2c2b9a7ed
Bump flume to v0.11.0 (#2384) (#2750) 2023-09-21 17:48:28 -07:00
Hannes Körber
35ba8e2b93
docs: Fix description of min_connections (#2687)
On `PoolOptions::connect()`, we open at least `min_connections`
connections, or 1 if unset. Therefore, the expression needs to be
`max()`. (`min(1, x)` would mean we always open only a single
connection).
2023-09-11 19:28:54 -07:00
Grant G
c0d4019d17
Add impl for Type, Decode, and Encode for Box<str> and Box<[u8]> (#2712) 2023-09-11 19:28:18 -07:00
Daniel Black
a6a2af115e
Bump mariadb CI images + mysql unpin (#2739)
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.
2023-09-11 19:19:28 -07:00
Bogdan Mircea
745486b485
Remove sealed trait comments from documentation (#2740)
* Fix Row trait docs as it isn't sealed anymore

* Fix ColumnIndex trait docs as it isn't sealed anymore
2023-09-11 19:03:02 -07:00
Bogdan Mircea
4d12ca4e1d
Implemented poll_flush for Box<S:Socket> (#2742) 2023-09-11 19:02:38 -07:00
Edwin
2e4533eb32
remove &mut PoolConnection from docs (#2695) 2023-09-11 18:38:43 -07:00
Austin Bonander
2497f0bdc8 fix: run cargo fmt with latest Rust 2023-09-11 18:06:16 -07:00
JJ Ferman
19e59ffa5a
Update README.md (#2717)
0.7 was released now, we can remove notes about it's pending release
2023-09-11 18:02:48 -07:00
Max Vorobev
d0fbe7feff
Automatically infer migration type (#2664) 2023-08-01 11:16:43 -07:00
Austin Bonander
487b89a4b6
fix: ignore extra fields in Postgres describe parsing (#2670)
* 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>
2023-07-31 14:52:55 -07:00
Yuri Astrakhan
a8a0579713
Treat warnings as errors on CI builds (#2651) 2023-07-31 13:29:07 -07:00
Yuri Astrakhan
a824e8468c
Cleanup format arguments (#2650)
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
```
2023-07-31 13:27:04 -07:00
Marco Cameriero
9463b7592f
Add JSON support to FromRow derive (#2121)
* Add `json` attribute to `FromRow` derive

* Add docs and fix formatting
2023-07-31 12:52:42 -07:00
Ameer Ghani
84f21e99ef
cli: add --target-version CLI flags for migrate run/revert (#2538)
* cli: add --target-version CLI flags for migrate run/revert

* cli: fix broken test

* cli: test harness for `sqlx migrate` along with --target-version tests

* cli: Fail if version supplied to run/revert is too old/new

After some discussion with my coworkers, we thought about the behavior a bit more:

The behavior is now that for a run, if the provided version is too old, the CLI
will return with failure rather than being a no-op. This gives feedback to the
operator instead of being quiet.

It is still valid to up/downgrade to the latest version, this will still be a no-op
to allow for idempotency.
2023-07-31 12:49:53 -07:00
Lee Danilek
febf9ed775
Implement mysql_clear_password (#2533)
* mysql_clear_password

* comment

* refactor no-data edge case and add unit tests

* add a connection option to explicitly enable mysql_clear_password

* cargo fmt

* scary comment & log warning
2023-07-31 12:41:02 -07:00
Sebastian N. Fernandez
7e7dded8af
Adding PgHasArrayType for &[u8;N] (#2634)
* Adding PgHasArrayType for &[u8;N]

* cargo fmt

---------

Co-authored-by: asdf <asdf@ethereum>
2023-07-24 16:10:42 -07:00
Sebastian
eae9484710
typo: BYTE -> BINARY (#2624)
MySQL does not have a BYTE type.
2023-07-24 16:09:22 -07:00
Joakim Malmberg
8cad54cc9f
Add postgres chat exmaple (#2577)
Co-authored-by: Stephen <webmaster@scd31.com>
2023-07-24 16:09:06 -07:00
Marcus Pettersen Irgens
b066af6b17
0.7 is stable (#2628)
Looks like the note one one of the examples was left out when updating the README.
2023-07-24 16:07:37 -07:00
Jesse Wang
94379d88b3
fix(postgres): fix buffer management in PgCopyIn.read_from (#2630) 2023-07-24 16:07:29 -07:00
Max Vorobev
f2bb464bcd
Support naming migrations sequentially (#2602)
* Support naming migrations sequentially and inferring naming scheme

* Document new options and how naming is inferred

* Only account for up migrations when inferring ordering
2023-07-24 16:00:26 -07:00
Austin Bonander
c70cfaf035
prepare 0.7.1 release (#2621) 2023-07-14 17:24:52 -07:00
Johannes
f7ce8fd9f4
Implement Default for QueryBuilder (#2605) 2023-07-14 16:28:14 -07:00
Luiz Carvalho
3662bdab84
fix(sqlite): encode bool as integer (#2620) 2023-07-14 16:27:53 -07:00
Austin Bonander
1d1095e94f
feat: allow opt-out of PgHasArrayType with #[derive(sqlx::Type)] (#2619)
closes #2611
2023-07-14 16:16:18 -07:00
Vabka
3268698f2e
Update README.md (#2613)
Actually there is `rust_decimal` feature,  not just `decimal`
2023-07-14 12:30:11 -07:00
Jakub Kołodziejczak
66436565e8
docs(changelog): be more verbose about offline mode breaking change (#2603) 2023-07-14 10:43:03 -07:00
Quang Le
74370f7ef0
Introduce build_query_scalar for QueryBuilder (#2551) 2023-07-14 10:42:19 -07:00
Simon Menke
aee0e18b0b
Remove incorrect CAST in test database cleanup for MySQL. (#2599)
* Remove incorrect CAST in test daatbase cleanup for MySQL.

* Not sure how this ever really worked.
2023-07-14 10:38:12 -07:00
Luiz Carvalho
3db16751a0
feat(sqlx-core): add table function to database error (#2616) 2023-07-14 10:37:02 -07:00
Jonathan Newnham
afb6b1066e
improve docs about migration files (#2566) 2023-07-10 14:36:05 -07:00
Austin Bonander
56ccdd294b
fix(CHANGELOG): mention AnyEncode removal
closes #2598
2023-07-10 12:34:26 -07:00
Andrew Lilley Brinker
f06c4c27ce
Implement Clone for PoolOptions manually (#2548) (#2553)
* Implement Clone for PoolOptions manually (#2548)

Trying to derive `Clone` automatically for `PoolOptions` results
in errors when `clone` is actually called. This is because the
derive incorrectly determines that `Clone` is _not_ derivable
due to the lack of `Clone` implementation on the `DB: Database`
type parameter, even though no value of that type is actually
stored in a to-be-cloned position (in fact, it's only used for
the `Connection` associated type on the type parameter's
`Database` trait impl).

Manually implementing `Clone` side-steps this issue and insures
the type is always actually cloneable.

For reference: https://github.com/launchbadge/sqlx/issues/2548

* Ran 'cargo fmt'

* Simplified Arc cloning
2023-07-09 14:34:31 -07:00
Jon Heinritz
8b223e24d3
Update clap to v4.3.10 (#2576) 2023-07-09 13:13:43 -07:00
Dennis Schubert
b283a31e4b
Correct mention of the tls-native-tls in the documentation. (#2593) 2023-07-08 12:42:50 -07:00
Paolo Barbolini
a87a871913
Bump webpki-roots to v0.24 (#2597) 2023-07-08 12:42:32 -07:00
Jack DeNeut
258eacafd9
Fix for Issue #2549 - cannot use feature "rust_decimal" without also using "bigdecimal" (#2585)
* Fix missing num-bigint dependency for rust_decimal

* Fix missing feature name change from "decimal" to "rust_decimal"

* update missing "decimal"->"rust_decimal" renaming in range.rs

* Update money.rs references to "decimal"

* Update "decimal" -> "rust_decimal"
2023-07-06 16:02:47 -07:00
saolof
016884454b
Update README.md now that 0.7.0 is no longer in alpha (#2580)
* Update README.md

0.7.0 is now released on crates.io

* Update README.md

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-07-06 16:01:37 -07:00
kitterion
310af5c2c8
Fix optional dependency on sqlx-macros (#2586) 2023-07-06 16:01:21 -07:00
Austin Bonander
af67b136cd
fix(CHANGELOG): copy breaking changes list from #2039 2023-07-03 15:34:45 -07:00
Austin Bonander
dcb58b0e2c
0.7.0 release (#2575)
* WIP preparing 0.7.0 release

* fix: re-enable examples

* fix doctests in `sqlx-core`

* cherry-pick CHANGELOG entry for 0.6.3

* add actions workflow for examples

* fix(cli): close connection after running migrations

* fix examples

* fix(sqlite): fix parsing of URLs via `Any`

* fix(example): don't let Postgres `listen` example run forever

* fix Postgres `transaction` example
2023-07-03 14:37:37 -07:00
Andrew Lilley Brinker
1bdbedabdc
Impl AsMut for advisory lock types (#2520) (#2554)
The documentation for `PgAdvisoryLockGuard` lists a set of types
that should be able to be passed to it, but when actually trying
to do so, compilation would fail due to missing `AsMut` trait
implementations for those types. This commit adds the missing
`AsMut` impls so that `Transaction` and `PgConnection` can be used
as type parameters to `PgAdvisoryLockGuard`, as expected.

For reference: https://github.com/launchbadge/sqlx/issues/2520
2023-06-30 16:53:14 -07:00
Austin Bonander
e2ce463af8
doc: make it clear that ConnectOptions types impl FromStr (#2574) 2023-06-30 16:49:24 -07:00
Andrew Whitehead
3fbc3a3ff2
(sqlite) do not drop notify mutex until after condvar is triggered (#2573)
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
2023-06-30 16:48:52 -07:00
Jon Heinritz
1b7631eddc
Add CLI autocompletion using clap_complete (#2559) 2023-06-30 14:59:35 -07:00
Elliot Speck
4b254ea1cb
sqlite date macro support (#2491)
* 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.
2023-06-30 14:56:32 -07:00
Iban Eguia Moraza
87ff6457b9
Exposing the Oid of PostgreSQL types (#2507)
* Exposing the Oid of PostgreSQL types

* Do not panic if OID is not set

* Update sqlx-postgres/src/type_info.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* cargo fmt

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-06-30 14:35:42 -07:00
Bastian
c2e54eae6f
add args to query builder (#2494) (#2506)
* add args to query builder (#2494)

* add test

* Update sqlx-core/src/query_builder.rs

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* fmt

---------

Co-authored-by: Bastian Schubert <bastian.schubert@dock.financial>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-06-30 14:26:25 -07:00