Commit graph

2508 commits

Author SHA1 Message Date
Yuri Astrakhan
ee3b94d726
Prevent warnings running cargo build (#2856)
When none of the features is enabled (default features), prevent compiler warnings.
2023-11-06 12:47:47 -08:00
Austin Bonander
cd39cb2e29
Create pull_request_template.md 2023-11-03 18:03:10 -07:00
Brian Heineman
92523f3629
Update extra_float_digits default to 2 instead of 3 (#2832) 2023-11-03 17:23:53 -07:00
Rico
220bf93dc2
Fix comment in sqlx migrate add help (#2847)
The old description for the `sequential` flag read "If set, use *timestamp* versioning".
I guess this was a simple copy-paste error.
2023-11-03 17:23:36 -07:00
Austin Bonander
9dbd52c9b3
fix(core): avoid unnecessary wakeups in try_stream!() (#2850)
fixes #2834
2023-11-03 17:23:25 -07:00
Austin Bonander
82fadce729 doc: inline reexports from drivers 2023-11-01 18:32:29 -07:00
Boris.Lok
e1ac388173
Provide fn PgConnectOptions::get_host(&self) (#2752)
Co-authored-by: boris <boris.lok@cienet.com>
2023-10-23 16:48:41 -07:00
Nano
ba87bf7473
Add impl FromRow for the unit type (#2827) 2023-10-23 16:45:33 -07:00
Dirkjan Ochtman
068ea14665
chore: bump some sqlx-core dependencies (#2826)
* chore: update Cargo.lock

* chore: avoid deprecated chrono API

* chore: avoid deprecated rustls API

* chore: bump webpki-roots to 0.25

* chore: remove unused generic-array dependency
2023-10-23 15:19:55 -07:00
Anup Jadhav
49ccc7ca32
issue #2821 Update error handling logic when opening a TCP connection (#2822)
This commit updates the error handling logic in the `connect_tcp` function. Previously, the function would panic if the hostname did not resolve to at least one address.

The updated logic attempts to establish a TCP connection for each address that the hostname resolves to. If it fails to connect to any of the addresses, it will return the last encountered error. If the hostname doesn't resolve to any addresses, the function returns a custom error message stating "Hostname did not resolve to any addresses".
2023-10-19 14:55:45 -07:00
qwerty2501
00b077ab14
Is tests/x.py maintained? And I tried fix it. (#2754)
* 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.
2023-10-19 14:54:01 -07:00
Nemo157
080d57af3a
Customize the macro error message based on offline status (#2769) 2023-10-17 16:25:09 -07:00
Gregor Giesen
54c5d6bc3c
derive FromRow: sqlx(default) for all fields (#2801)
* derive FromRow: sqlx(default) for all fields

* error in test_struct_default fixed

* derive FromRow: struct level sqlx(default) requires and uses Default implementation

* Update sqlx-core/src/from_row.rs

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

* Update sqlx-core/src/from_row.rs

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

* satify cargo fmt

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-10-17 16:13:40 -07:00
失魂魚
a7d2703d64
Add additional info regarding using Transaction and PoolConnection as Executor (#2713)
Copy-paste from https://github.com/launchbadge/sqlx/blob/main/CHANGELOG.md#070---2023-06-30
2023-10-17 16:11:56 -07:00
Peter Hamilton
ab0d10d935
Make PgListener recover from UnexpectedEof (#2684)
This is often encountered when the host the db is on is restarted.
For example, a reboot of AWS Aurora causes this. If we don't handle this
properly the PgListeners are stuck in an erroring state, even when the DB
is back online. By catching it here, we will reconnect when it is
(eventually) back online.
2023-10-17 16:10:53 -07:00
Uttarayan Mondal
b85b72355e
[fix] Urlencode when passing filenames to sqlite3 (#2655) 2023-10-17 11:44:25 -07:00
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