Commit Graph

2577 Commits

Author SHA1 Message Date
Chris Hanks
4f10962743 Add PgListener::next_buffered(), to support batch processing of notifications (#3560)
* Implement and test PgListener::try_recv_buffered().

* rustfmt

* Fix warnings.

* Fix test.

* Rename try_recv_buffered() -> next_buffered().
2024-11-27 13:56:01 -08:00
Sean Lynch
503a72c94f Eagerly reconnect in PgListener::try_recv (#3585)
When PgListener's underlying connection is closed, try_recv() will
return Ok(None) and reconnect on the next call. In this case, user code
is supposed to reload its state from the database (or otherwise handle
potentially missing messages). However, if the user code uses another
database connection to do so then there is a period between when the
state is reloaded and PgListener's connection is re-established where
notifications are lost without any indication that this has happened.

This commit changes PgListener to eagerly reconnect by default. At the
suggestion of @abonander on discord, I have also included an option to
switch back to the old behaviour in the case where someone was depending
on it.

Now, if the connection is closed then, by default, user code can do
whatever it needs to do in order to recover and any notifications
emitted in the meantime will be waiting for it when it is done.
2024-11-27 13:52:23 -08:00
XueHaonan
5c6623dee2 fix: fix example code of query_as (#3558)
query_as.rs: 230 mismatched bracket.
query_as.rs: 230 move TIMESTAMP to TIMESTAMPTZ to match type time::OffsetDateTime.
query_as.rs: 241, 251, 260 move i64 to i32 to match postgres type `INT4`.
2024-11-27 13:51:52 -08:00
Benoit Ranque
e3ef8baf23 URL decode database name when parsing connection url (#3593) 2024-11-27 13:48:34 -08:00
James H.
a7f2928a1b feat(postgres): point (#3583)
* feat: point

* test: try if eq operator works for arrays of geometries

* fix: re-introduce comparison

* fix: test other geometry comparison

* test: geometry array equality check

* test: array match for geo arrays geo match for geo only

* fix: prepare geometric array type

* fix: update array comparison

* fix: try another method of geometric array comparison

* fix: one more geometry match tests

* fix: correct query syntax

* test: geometry test further
2024-11-27 13:35:42 -08:00
Paolo Barbolini
3e8952b0d4 Bump thiserror to v2.0.0 (#3596) 2024-11-26 11:01:33 -08:00
Henri Sivonen
4fac945d5a Remove default-features = false from url (#3601)
Fixes #3589.
2024-11-26 11:01:18 -08:00
Andrew Eggleston
8dfd3e0bc6 Fix mistake in sqlx::test fixtures docs (#3604)
Alternative option for the sqlx::test fixtures referenced the same fixture twice
2024-11-26 11:00:05 -08:00
Jakub Łabor
80314609ac Use UNION ALL instead of UNION in nullable check (#3605) 2024-11-26 10:59:47 -08:00
Pmarquez
d4ae6ffd88 Implement AnyQueryResult for Sqlite and MySQL (#3608)
* impl AnyQueryResult for Sqlite and MySQL

* fix MySQL AnyQueryResult

* fix MySQL AnyQueryResult

* fix manifest

* rewrite `use` and address implementation concerns
2024-11-26 10:59:20 -08:00
Austin Bonander
82d332f4b4 doc(mysql): document difference between Uuid and uuid::fmt::Hyphenated (#3580) 2024-10-28 16:39:43 -07:00
Quentin Gliech
709226c19d Implement Acquire for PgListener (#3550)
* Implement Acquire for PgListener

* Add a test which checks that PgListener implements Acquire

* Drop unnecessary call to `.acquire()`

* Rename test channel to avoid conflict with other tests
2024-10-28 15:00:06 -07:00
Oleksandr Babak
eac4b7aff7 Fix: Cannot query Postgres INTERVAL[] (#3566)
* fix(sqlx-postgres): macro could not understand pg interval array type

* refactor(sqlx-postgres): move pg interval array types closer to other array types
2024-10-28 14:59:41 -07:00
Joris Willems
3fb00e1403 Reexport AnyTypeKind (#3579) 2024-10-28 14:59:18 -07:00
Dennis Schubert
028084bce3 Demote .pgpass file warning to a debug message. (#3548)
Fixes #3531
2024-10-06 15:21:56 -07:00
Trevor
cadf152e99 fix: remove sqlformat (#3545)
* removed sqlformat from sql-core/src/logger.rs causing ref error to FormatOptions

* removed sqlformat from sql-core/src/logger.rs causing ref error to FormatOptions

---------

Co-authored-by: tbarnes <tbarnes@tbserver.tbarnes-server.local>
2024-10-04 21:34:18 -07:00
Andrei Nesterov
19f40d87a6 Obey no-transaction flag in down migrations (#3528) 2024-10-02 15:32:30 -07:00
joeydewaal
72512f7311 Support PgHstore by default in macros (#3514)
* Support PgHstore in macros

* Change tests

* Remove unused import
2024-10-02 11:56:13 -07:00
依云
5b8bb3b28b Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library (#3507)
* Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library

* update README abouot the newly-added `sqlite-unbundled` feature

* Update README.md to make it clear with bulleted list

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

* more cfg feature updates

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

* update documentation in sqlx-sqlx/src/lib.rs too

and also mention possible build time increasement.

* cargo fmt

* Add "sqlite-unbundled" feature to sqlx-cli

* Add sqlite-unbundled to gituhb actions tests

* cfg(feature = "sqlite") => cfg(any(feature = "sqlite", feature = "sqlite-unbundled"))

* fix

* CI: make sqlite-unbundled tests workaround required-features

by duplicating the relevant test section

* use an internal "_sqlite" feature to do the conditional compilation

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2024-10-02 11:55:21 -07:00
joeydewaal
68da5aefea Box Pgconnection fields (#3529)
* Update PgConnection code

* rustfmt
2024-10-02 11:42:54 -07:00
Joey de Waal
81298b86b3 add regression test 2024-10-02 11:42:33 -07:00
Joey de Waal
e62bbd7ee9 Change test macro error message 2024-10-02 11:42:33 -07:00
Joey de Waal
ef039c5d67 recursively look for literal in test macro 2024-10-02 11:42:33 -07:00
vsuryamurthy
293c55ce89 Remove unused dependencies from sqlx-core, sqlx-cli and sqlx-postgres 2024-09-24 18:46:31 -07:00
Simon Brüggen
a496413cb6 doc(sqlite): show how to turn options into a pool (#3508)
It took me 15 minutes of messing around and googling to find
`.connect_with()`.
2024-09-15 21:38:00 -07:00
Austin Bonander
2f5ba71c1e chore(mysql): create test for passwordless auth (#3484) (#3505)
This isn't a solution for #3484, as that seems to be an issue with privileges on the user's side. However, in the process of figuring that out, I realized we never explicitly test password-less auth.
2024-09-14 11:51:22 -07:00
Austin Bonander
dc32f99c0f doc(README): more prominent link for Discord 2024-09-13 11:49:56 -07:00
gridbox
daeb87bef1 Add sqlite commit and rollback hooks (#3500)
* fix: Derive clone for SqliteOperation

* feat: Add sqlite commit and rollback hooks

---------

Co-authored-by: John Smith <asserta4@gmail.com>
2024-09-12 11:57:02 -07:00
Austin Bonander
419877d734 doc(sqlite): document behavior for zoned date-time types (#3493) 2024-09-08 21:53:10 -07:00
John Vandenberg
063953fe60 chore: Update async-std v1.13 in lock file (#3491) 2024-09-08 21:52:59 -07:00
Kurt Wolf
c597a225c5 feat: expose relation_id and relation_attribution_no on PgColumn (#3492)
* expose relation_id and relation_attribution_no on PgColumn

* Update sqlx-postgres/src/message/row_description.rs

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

* Update sqlx-postgres/src/column.rs

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

* Update sqlx-postgres/src/message/row_description.rs

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

* Update sqlx-postgres/src/column.rs

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

* Update sqlx-postgres/src/message/row_description.rs

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

* fix

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2024-09-07 18:43:03 -07:00
Austin Bonander
10bec32770 doc(FAQ): add example for MSRV v0.8.2 2024-09-03 14:14:56 -07:00
Austin Bonander
c253e65819 chore: prepare 0.8.2 release 2024-09-03 14:14:56 -07:00
Austin Bonander
998344dcb7 doc(FAQ): refine MSRV policy 2024-09-03 14:14:56 -07:00
Austin Bonander
6cb6fce793 fix(mysql): "exclusive range pattern is experimental" error
closes #3472
2024-09-03 14:14:56 -07:00
Pierre Wehbe
fd80f998ac fix: Use rfc3339 to decode date from text (#3411) 2024-09-02 12:34:51 -07:00
luveti
ad2936a9c4 Fix try_get example in README.md (#3474) 2024-09-01 02:14:55 -07:00
Austin Bonander
e10789d9d7 fix cancellation issues with PgListener, PgStream::recv() (#3467)
* fix(postgres): make `PgStream::recv_unchecked()` cancel-safe

* fix(postgres): make `PgListener` close the connection on-error

* fix: incorrect math in `BufferedSocket::read_buffered()`
2024-08-27 10:54:31 -07:00
Austin Bonander
20ba796b0d fix(postgres): max number of binds is 65535, not 32767 (regression) 2024-08-26 16:20:45 -07:00
kdesjard
371cf4a0cc Pgsql cube type compile fail (#3459)
* fails to compile as size_of is not found in scope

* keep scoping consistent with other type modules

* fmt fixes

---------

Co-authored-by: kdesjard <kristian.desjardins@nrcan-rncan.gc.ca>
2024-08-26 14:15:48 -07:00
carschandler
8a17bef7d7 Remove deprecated feature-names from Cargo.toml files in examples (#3424) 2024-08-26 14:03:45 -07:00
joeydewaal
1d8eb2add4 Fix (#3395) sqlx::test macro in 0.8 (#3403)
* 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
2024-08-26 14:03:22 -07:00
joeydewaal
ebf04ff499 fix(#3445): PgHasArrayType (#3453)
* fix(#3445): PgHasArrayType

* regression test for custom no_pg_array
2024-08-24 19:25:08 -07:00
joeydewaal
018ffe7e0d fix: non snake case warning (#3454)
* fix: non-snake-case fields warning

* cargo fmt
2024-08-24 19:24:53 -07:00
Leon Lux
f69f370f25 Clarify usage of Json/Jsonb in query macros (#3447)
* add information and example on using json in query macros

* run cargo format

* add missing bracket to docs of json

* wrap docs in hidden async function

* change no_run to ignore
2024-08-24 15:59:40 -07:00
Austin Bonander
1fb255935f fix(CHANGELOG): add missing links for new authors 2024-08-24 04:36:48 -07:00
Austin Bonander
9c94ce891a chore: prepare release 0.8.1 v0.8.1 2024-08-24 00:17:41 -07:00
Austin Bonander
0aa06763e5 chore(mysql): create regression test for RUSTSEC-2024-0363 2024-08-23 23:39:32 -07:00
Austin Bonander
791433afbb chore(sqlite): create regression test for RUSTSEC-2024-0363 2024-08-23 23:39:32 -07:00
Austin Bonander
b1539b60a1 chore(postgres): create regression test for RUSTSEC-2024-0363 2024-08-23 23:39:32 -07:00