Commit graph

2292 commits

Author SHA1 Message Date
Matt Fellenz
b16fbebf2f
Don't use separate temp dir for query jsons (2) (#2803)
* Don't use temp dir for query jsons

Fixes #2663

* Return early when exclusive create fails

* Use atomic-file-write for writing query data
2023-10-17 11:41:30 -07:00
Conrad Ludgate
f93bbe87be
postgres begin cancel safe (#2819) 2023-10-16 19:20:48 -07:00
Austin Bonander
58cb18a47a
fix: correct decoding of rust_decimal::Decimal for high-precision values (#2820)
also fixes handling of feature flags
2023-10-16 14:03:28 -07:00
hgranthorner
540baf7df5
feat(citext): support postgres citext (#2478)
* 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>
2023-10-11 18:03:36 -07:00
hgranthorner
56945d7396
feat(citext): support postgres citext (#2478)
* 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>
2023-10-11 18:03:17 -07:00
Fernando Gonçalves
3c2471e2dc
fix: sqlx::macro db cleanup race condition by adding a margin to current timestamp (#2640)
* fix: sqlx::macro db cleanup race condition by adding a margin to current timestamp

* feat: increase margin to 2 seconds
2023-10-11 16:03:53 -07:00
tk2217
5ebe296ecb
feat(mysql): support packet splitting (#2665)
* Writing split packets

* Reading split packets

* Add tests for packet splitting

* Fix test for packet splitting
2023-10-11 13:59:06 -07:00
A248
b1387057e5
Depend on version of async-std with non-private spawn-blocking (#2806) 2023-10-07 21:00:45 -07:00
Baptiste
b7db3c5015
remove documentation on offline feature (#2701) 2023-10-06 14:04:17 -07:00
snspinn
7e9592c267
Update README.md (#2770)
* Update README.md

Quick helper on the async_std quickstart

* Move comment regard. `attributes` into code example

* doc(README): adjust wording of a comment

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-10-06 14:02:34 -07:00
Yudai Fukushima
846dcfe52a
fix: decode postgres time without subsecond (#2784)
* fix: decode postgres time without subsecond

* update: decode postgres time without subsecond by making subsecond optional
2023-10-04 16:56:14 -07:00
Austin Bonander
4bac21da37
doc: update mention of MSSQL in README 2023-10-04 15:55:04 -07:00
Austin Bonander
0247acaa91
doc(mysql): document behavior regarding BOOLEAN and the query macros (#2797) 2023-10-04 15:36:58 -07:00
Ramzi Sabra
c2eda1c8ac
derived Hash trait for PgInterval (#2793) 2023-10-04 13:47:10 -07:00
Austin Bonander
e80291b2a7
chore: prepare 0.7.2 release (#2782) 2023-09-26 14:35:56 -07:00
wyhaya
3b9a2743ec
Support for setting client certificate and key from bytes (#2646)
* Support for setting client certificate and key from bytes

* Rename ssh_client_*_from_bytes to ssl_client_*_from_pem

* doc: clarify client_*_from_pem docs and add examples

* doc: apply missed suggestions from previous commit

* fix: run `cargo fmt`

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Co-authored-by: Austin Bonander <austin@launchbadge.com>
2023-09-25 18:29:39 -07:00
Adriano Di Luzio
6bec8574d4
Remove unused remove_dir_all crate (#2757) 2023-09-25 18:01:56 -07:00
Austin Bonander
264ab5360b fix: run cargo fmt with latest Rust (again...) 2023-09-25 17:53:16 -07:00
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