Commit graph

2435 commits

Author SHA1 Message Date
Austin Bonander
3418455482 fix: ignore flaky copy_can_work_with_failed_transactions test 2024-06-13 13:11:36 -07:00
Austin Bonander
948264ff93 fix: ignore flaky test_connection_maintenance test 2024-06-13 13:11:36 -07:00
Austin Bonander
f7301f67d1 fix(ci): don't run TLS tests when building without TLS (duh) 2024-06-13 13:11:36 -07:00
Austin Bonander
16ffaed73b fix(ci): stop testing on MySQL 5.7
MySQL 5.7 was EOL'd in October 2023.
2024-06-13 13:11:36 -07:00
Austin Bonander
79a5830437 fix: missing DATABASE_URL in CI
the changed steps weren't actually meant to run the tests yet
2024-06-13 13:11:36 -07:00
Austin Bonander
bae083cf79 fix: clippy warnings 2024-06-13 13:11:36 -07:00
Austin Bonander
41089f3655 fix: add mariadb:11.4 to tests/docker-compose.yml 2024-06-13 13:11:36 -07:00
Austin Bonander
0f6054cf81 fix: run cargo fmt 2024-06-13 13:11:36 -07:00
Joel Koen
1388fc8acc
docs(sqlite): fix typo - unixtime() -> unixepoch() (#3271) 2024-06-07 02:51:52 -06:00
gridbox
0ea90881c1
feat: Add set_update_hook on SqliteConnection (#3260)
* feat: Add set_update_hook on SqliteConnection

* refactor: Address PR comments

* fix: Expose UpdateHookResult for public use

---------

Co-authored-by: John Smith <asserta4@gmail.com>
2024-06-05 19:06:15 -07:00
Daniel Black
8b7f352be8
ci: syntax fix (#3267)
Correct:

Invalid workflow file: .github/workflows/sqlx.yml#L207
You have an error in your yaml syntax on line 207
2024-06-05 19:04:51 -07:00
Dario Heinisch
c57bcb967f
Hide docs for any (#3254) 2024-06-05 18:21:10 -07:00
Stepan Tubanov
5da0f73746
perf: box MySqlConnection to reduce sizes of futures (#3265) 2024-06-05 18:19:30 -07:00
Daniel Black
4d9f67b7b4
ci: MariaDB - add back 11.4 and add 11.5 (#3266)
* Revert "fix(ci): disable `mariadb_verylatest` pass for RusTLS"

This reverts commit c78425b3ac.

MariaDB 11.4.2 now includes the upstream fix for this.

Closes: 3091

* ci: mariadb 11.4 now GA/Stable
2024-06-05 18:18:58 -07:00
AlphaKeks
6561830421
feat: support NonZero* scalar types (#3244)
* feat: support `NonZero*` scalar types

This commits adds `Type`, `Encode`, and `Decode` impls for all the
`NonZero*` types from the standard library. They are implemented as
direct proxies to their primitive counterparts, except that when
decoding, the values are checked to not be zero.

* fixup!: remove `non-zero` cargo feature

* fixup!: make `non-zero` module private

* fixup!: rebase and fix trait impls
2024-06-05 13:18:04 -06:00
ben
1ce0e760de
fix: Decode and Encode derives (#2940) 2024-05-31 13:04:13 -07:00
Ralph Bisschops
240b4fffd3
Fix several inter doc links (#2954) 2024-05-31 12:59:08 -07:00
tyrelr
f960d5bc3b
Sqlite explain graph (#3064)
* convert logger to output a query graph

* avoid duplicating branch paths to shrink output graph

* separate different branching paths

* include all branches which found unique states

* track the reason for ending each branches execution

* track the result type of each branch

* make edges rely on history index instead of program_id, to avoid errors when looping

* add state diff to query graph

* drop redundant table info

* rework graph to show state changes, rework logger to store state snapshots

* show state on the previous operation

* gather duplicate state changes into clusters to reduce repetition

* draw invisible connections between unknown instructions by program_i

* clean up dot format string escaping

* add test case from #1960 (update returning all columns)

* add tests for #2939 (update returning only the PK column)

* allow inserting into a table using only the index

* improve null handling of IfNull, fix output type of NewRowId

* add NoResult nodes for branches which don't log a result, as a sanity check

* add short-circuit to all logging operations

* remove duplicate logging checks, and make logging enabled/disabled consistently depend on sqlx::explain instead of sqlx for capture & sqlx::explain for output

* add failing test for awkwardly nested/filtered count subquery

* handle special case of return operation to fix failing test

* require trace log level instead of using whatever log level  statement logging was configured to use
2024-05-31 12:57:54 -07:00
Liam Gray
2df770a10b
SqliteConnectOptions::filename() memory fix (#3136) (#3137)
* SqliteConnectOptions::filename() memory fix (#3136)

* Expose in_memory sqlite option

* Docs SqliteConnectOptions::filename include mention of from_str alternative

* Docs SqliteConnectOptions::filename typo fix
2024-05-31 12:45:27 -07:00
Max Bruckner
c57b46ceb6
Make Encode return a result (#3126)
* 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
2024-05-31 12:42:36 -07:00
Lílian
6c1e3a4e61
fix: resolve path ownership problems when using sqlx_macros_unstable (#3236)
* 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
2024-05-30 15:46:14 -07:00
Jason Ish
0449ac5c1f
fix: sqlite pragma order for auto_vacuum (#3230)
* fix: sqlite pragma order for auto_vacuum

Setting the auto_vacuum pragma must come before setting the journal
mode otherwise it won't apply.

* fix: better documentation for auto_vacuum

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

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2024-05-17 18:58:02 -07:00
Jason Ish
e7f71900f8
fix: get_filename should not consume self (#3233) 2024-05-17 18:57:49 -07:00
Austin Bonander
60d033eda2
fix(ci): pin Rust version, ditch unmaintained actions (#3234) 2024-05-14 23:57:31 -07:00
Filip Gospodinov
5d6c33ed65
bump rustls to 0.21.11 (#3216)
This fixes security issue RUSTSEC-2024-0336 [1].

[1] https://rustsec.org/advisories/RUSTSEC-2024-0336
2024-04-26 16:26:52 -07:00
Dan Griffin
c82bf43e98
Fix leaking connections in fetch_optional (#2647) (#3194)
When using the 'Any' driver with MySQL backend, fetch_optional
does not return the connection to the pool if no results
are returned from the query. This is due to not all of the packets
being read from the underlying stream.

This fix continues to read result packets from the stream until they
have all been exhausted (just like the normal MySql drivers
implementation of fetch_optional). In general, a better refactoring would
be to call the MySQL fetch_optional code in the Any driver, rather than
re-implementing and duplicating code.
2024-04-24 19:18:55 -07:00
Grzegorz Bartoszek
a5d7fffc1b
Add Debug impl for PgRow (#2917) 2024-04-22 15:39:39 -07:00
Austin Bonander
439ac858d1
add #3211 to create-issue links 2024-04-20 18:30:46 -07:00
Pmarquez
ceac70f7fa
fix: Option decoding in any driver (#3172) 2024-04-19 15:46:03 -07:00
Feike Steenbergen
17d832b3de
PostgreSQL Bugfix: Ensure connection is usable after failed COPY inside a transaction (#3138)
* Include test case for regular subtransactions

While using COPY and subtransactions I kept running into errors.
This test case documents that error, it currently fails with:

    Error: encountered unexpected or invalid data: expecting ParseComplete but received CommandComplete

* PostgreSQL Copy: Consume ReadyForQuery on error

When a COPY statement was in error inside a subtransaction,
a Protocol Error used to be raised. By consuming the ReadyForQuery
message when there is an error, we no longer have this issue.
2024-04-19 15:45:05 -07:00
Raghav
e42ee35a76
fix(postgres) : int type conversion while decoding (#3173)
* fix(postgres) : int type conversion while decoding

* Check value buffer len when decoding integer type in postgres

* decode from octal for postgres i8

---------

Co-authored-by: RaghavRox <66472843+RaghavRox@users.noreply.github.com>
2024-04-19 15:43:06 -07:00
Jaime
40aef6da2c
feat: no tx migration (#3181)
* 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
2024-04-19 15:42:44 -07:00
Austin Bonander
25efb2f7f4
breaking(sqlite): always use i64 as intermediate when decoding (#3184)
Breaking changes:

* integer decoding will now loudly error on overflow instead of silently truncating.
* some usages of the query!() macros might change an i32 to an i64.

Also adds support for *decoding* `u64`s because there's no reason not to.

Closes #3179
2024-04-13 16:59:13 -07:00
BlackSoulHub
6a4f61e3b3
Update time to 0.3.36 (#3190)
* update time to 0.3.35

* fmt fix

* update version to 0.3.36
2024-04-11 19:26:12 -07:00
Lev Kokotov
03926dec15
Fix unclean TLS shutdown (#3191)
* Fix dirty shutdown

* generic comment
2024-04-10 17:10:27 -07:00
Gnome!
3e7aa6bedf
Bump deps that do not need code changes (#3165) 2024-04-06 00:07:36 -07:00
Maciej Flak
45b5b61d7b
Add version information for failed cli migration (#3129) (#3130) 2024-04-04 21:45:21 -07:00
Austin Bonander
0aae849657
fix(ci): use docker compose instead of docker-compose (#3167)
https://github.com/actions/runner-images/issues/9557
2024-04-02 16:15:09 -07:00
iamjpotts
d600ec0293
feat(logging): Log acquires from connection pool (#3073)
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-04-01 19:35:50 -07:00
Paolo Barbolini
e0a72cf8f2
Drop urlencoding dependency (#3162) 2024-03-30 16:17:04 -07:00
Cody Casterline
352b02de6a
Bump libsqlite3-sys to v0.28 (#3148)
This includes SQLite v3.45(.1), which includes new JSONB functionality.
2024-03-30 15:59:51 -07:00
Austin Bonander
02c68a46c7
refactor: lift type mappings into driver crates (#2970)
Motivated by #2917
2024-03-30 15:52:52 -07:00
Luiz Carvalho
1c7b3d0751
feat: new derive feature flag (#3113)
* feat: new derive feature flag

* doc: add new derive flag to readme

* fix: macros feature flag cfg
2024-03-30 15:24:56 -07:00
Austin Bonander
7102a7a254
feat: add MySqlTime, audit mysql::types for panics (#3154)
Also clarifies the handling of `TIME` (we never realized it's used for both time-of-day and signed intervals) and adds appropriate impls for `std::time::Duration`, `time::Duration`, `chrono::TimeDelta`
2024-03-30 11:49:12 -07:00
Bogdan Mircea
1f6642cafa
Reorder attrs in sqlx::test macro (#3123) 2024-03-27 20:20:41 -07:00
Austin Bonander
59d5ba606e
fix(sqlite): delete unused ConnectionHandleRaw type (#3146) 2024-03-22 22:15:37 -07:00
Austin Bonander
0b91ea68e5
fix(tests): extend fresh-connection threshold
This assert is failing with durations _just_ over the line, suggesting a timing issue.
2024-03-22 15:50:54 -07:00
Bogdan Mircea
e0a1f1633c
Removed Send bound from arg binding (#2960) 2024-03-14 12:39:02 -07:00
Tyler Hawkes
b607251fc4
Implement PgHasArrayType for all references (#2869) 2024-03-14 12:38:19 -07:00
Daniel
0d0dddf1d0
Constrain cyclic associated types (#2702)
Add bounds such that cyclic associated types are equal to themselves.
```
<T as Connection>::Database as Database>::Connection == T
<T as ConnectOptions>::Connection as Connection>::Options == T
<T as Row>::Database as Database>::Row == T
<T as Column>::Database as Database>::Column == T
<T as Value>::Database as Database>::Value == T
```
2024-03-14 12:37:28 -07:00