Commit graph

2487 commits

Author SHA1 Message Date
Austin Bonander
9d7a42b700 WIP feat(sqlite): create better constructors for SqliteConnectOptions 2024-08-04 20:07:42 -07:00
cycraig
4acecfc636
fix(sqlx-cli): do not clean sqlx during prepare (#2786)
* fix(cli): do not clean sqlx during prepare

* feat(cli): only clean dependencies with new --all flag for prepare
2024-08-01 15:36:42 -07:00
Clark Kampfe
ff0252d4c2
sqlite: fix inconsistent read-after-write (#3354)
* sqlite: fix inconsistent read-after-write

fetch_one/fetch_optional

* try pushing fetch_optional early-return into worker

* run cargo fmt

* fix "it_can_execute_multiple_statements" test failure

* use Option<usize> instead of bespoke enum for rows returned
2024-08-01 13:27:01 -07:00
Denis Otkidach
572e2a4ed5
fix(cli): typo in error for required DB URL (#3389) 2024-07-29 17:28:41 -07:00
Frank Elsinga
fd4cb99fc7
chore(examples):Migrated the pg-chat example to ratatui (#3385)
* migrated the pg-chat example to ratatui

* fixed formatting mistake
2024-07-29 04:35:27 -07:00
Frank Elsinga
cc481827d9
fixed deprecation warnings (#3384) 2024-07-27 18:04:20 -07:00
Frank Elsinga
49d5dd7f42
bumped to libsqlite3-sys=0.30.1 (#3382) 2024-07-27 17:59:00 -07:00
Frank Elsinga
e089d2fb55
bumped cargo_metadata to v0.18.1 (#3386) 2024-07-27 16:19:26 -07:00
tottoto
4ce181f869
chore: replace structopt with clap in examples (#3380) 2024-07-27 02:51:20 -07:00
Austin Bonander
6651d2df72
Fix CI after Rust 1.80, remove dead feature references (#3381)
* fix(ci): update workflows/examples.yml

* Removed archived `actions-rs` actions
* Upgraded `Swatinem/rust-cache`, `actions/checkout`, `actions/download-artifact`, `actions/upload-artifact`

* chore: deprecate `AnyKind`

* fix: remove dead references to DB features in `sqlx-core`

This reactivates a couple of tests that had stopped working.

* chore(ci): move sqlx-cli checks to their own workflow

* fix(ci): remove remaining `uses: actions-rs/cargo`

* fix warnings

* chore: add titles to sqlx-cli jobs

* fix warnings (2)

* fix error in pool example

* fix warnings (3)

* fix query_builder test

* fix: don't run CLI tests on Windows

* chore: upgrade `rust-toolchain` to 1.80

* fix(postgres): fix missing Tokio specialization in `PgCopyIn`

Caught by the new `unexpected_cfgs` lint.

* fix new warnings
2024-07-26 23:15:32 -07:00
Austin Bonander
1e526a2bbf
doc: hide spec_error module (#3376)
The `spec_error` module implements the autoref specialization hack that's used in a single place in the derive macros. It wasn't meant to be a public API.

Given how arcane it must appear, I doubt anyone's tried using it outside of this project anyway.
2024-07-25 03:13:02 -07:00
Yuta Kobayashi
f2fea27cba
Fix encoding and decoding of MySQL enums in sqlx::Type (#3371) 2024-07-25 02:47:36 -07:00
Hamir Mahal
7cfbb24ee3 fix: usage of node12 in SQLx action 2024-07-24 22:27:32 -07:00
Austin Bonander
80fa6d1e45
fix(changelog): add missing entry for #2697 2024-07-23 10:53:51 -07:00
Austin Bonander
da0ffd7dcf chore: bump version to 0.8.0 2024-07-22 18:36:35 -07:00
Austin Bonander
9e1aa748c9 chore: prepare changelog entry for 0.8.0 2024-07-22 18:36:35 -07:00
Austin Bonander
c90a7fff49 fix: enable clock and std features of chrono for the workspace
fixes #3332
2024-07-22 18:36:35 -07:00
Jason Ish
c50572eef2
fix: sqlite update_hook char types (#3288)
Use "c_char" instead of "i8" as it resolves to the correct string type
on different architectures.

Fixes: #3287
2024-07-22 15:26:47 -07:00
Leon Lux
940d9fb994
Add example on how to use Transaction as Executor (#3311)
* add example using Transaction as Executor to docs

* change tx.as_mut() to &mut *tx
2024-07-22 15:15:57 -07:00
SrGesus
eaad7b2c9a
doc: Minor rust docs fixes (#3312)
* Fixed some rust docs intra-doc non functioning links

* Minor tweaks

* Added warning for MSSQL not being functional yet

* Fixed requested changes

* Readded missing time

* Aligned table
2024-07-20 12:59:52 -07:00
Austin Bonander
4fc5b30d65
breaking: fix name collision in FromRow, return Error::ColumnDecode for TryFrom errors (#3356)
* chore: create regression test for #3344

* fix(derives): use a parameter name that's less likely to collide

* breaking(derives): emit `Error::ColumnDecode` when a `TryFrom` conversion fails in `FromRow`

Breaking because `#[sqlx(default)]` on an individual field or the struct itself would have previously suppressed the error. This doesn't seem like good behavior as it could result in some potentially very difficult bugs.

Instead of using `TryFrom` for these fields, just implement `From` and apply the default explicitly.

* fix: run `cargo fmt`

* fix: use correct field in `ColumnDecode`
2024-07-19 23:03:47 -07:00
Frank Elsinga
b37b34bd04
chore:added a testcase for sqlx migrate add ... (#3352) 2024-07-19 18:50:18 -07:00
Jos Ahrens
543395d80a
fix: build script new line at eof (#3353)
When generating the build script, it will
fail `cargo fmt -- --check` because it is
missing a new line at the end of the file.
2024-07-19 14:53:45 -07:00
Kobus Ellis
4683cc34e5
Add support for PostgreSQL HSTORE data type (#3343)
* Add support for PostgreSQL HSTORE data type

* Changes to make the future evolution of the API easier

* Fix clippy lints

* Add basic documentation
2024-07-19 14:33:16 -07:00
Frank Elsinga
08e45f4344
fix:the json-feature should activate sqlx-postgres?/json as well (#3350)
* fix: made sure that the json feature is defined for postgres as well

* fixed the feature order

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

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2024-07-16 14:32:41 -07:00
JohannesIBK
905df7ef3a
add array support for NonZeroI* in postgres (#3303)
* add array support for NonZeroI* in postgres

* run rustfmt
2024-07-16 13:46:43 -07:00
Frank Elsinga
3396ed015b
chore: fixed one usage of select_input_type!() being unhygenic (#3327)
The `$crate::` is currently not nessesary, but future refactorings might get tripped up if the typo is not fixed
2024-07-16 13:46:18 -07:00
YgorSouza
f2f17a7bc5
fix(postgres): don't panic if M or C Notice fields are not UTF-8 (#3346)
* fix(postgres): don't panic if `M` or `C` Notice fields are not UTF-8

This has been observed with an old version of PostgreSQL (11.0.4)
running on Windows Server 2016 with windows-1252 encoding and French
locale.

This change replaces invalid UTF-8 fields with a default string, so the
other fields can still be read if they are valid.

* Revert "fix(postgres): don't panic if `M` or `C` Notice fields are not UTF-8"

This reverts commit 362ca98bbd.

* Check that Notice M and C fields are valid UTF-8

Otherwise, we return the invalid UTF-8 error to avoid panicking later.
2024-07-16 00:27:20 -07:00
Hamir Mahal
83a7d14e58
fix: comment not separated from other characters (#3328) 2024-07-15 20:00:41 -07:00
Eric Torreborre
b71221cd74
use the persistent query setting with the Any driver (#3297) 2024-07-15 16:57:43 -07:00
James H
0db12a9846
feat(cube): support postgres cube (#3188)
* feat: add cube

* docs: cube docs

* docs: update readme

* fix: cube is now not feature flagged

* fix: formatting

* fix: typeo for PgCube vs Cube

* fix: correct types

* fix: postgres only types for cube

* fix: cube readme

* fix: dont unwrap cubes

* fix: typo on interval

* fix: zero volume cube array

* fix: return type

* fix: update tests

* fix: run with one test type

* fix: log bytes in error

* fix: typo in test

* fix: log bytes for failed length

* fix: string deser

* docs: remove cube from readme

* fix: int to float

* fix: trim floats

* fix: exttra test

* fix: type safe into vectors

* fix: improve error messages

* docs: remove comments

* fix: front load most important logic and const at start

* fix: extract constants

* fix: flags

* fix: avoid redundant buffer creation and use FromStr trait

* fix: handle serializing

* test: cube vec test

* fix: no array cube test

* fix: update test with array for cube

* fix: dont use try from for u8

* fix: conditionally remove padding

* fix: conditional trimming

* fix: idiomatic trimming

* fix: linting

* fix: remove whitespace

* fix: lower case array

* fix: spacing input

* test: one more vec test

* fix: trim square brackets in case they are using postgres spec page

* fix: result types

* fix: format

* fix: box error

* fix: the borrow produces a value

* fix: self serialise

* chore: merge main

* fix: borrow

* fix: clippy

---------

Co-authored-by: James Holman <james.holman@betashares.com.au>
2024-07-11 22:30:49 -07:00
etorreborre
93f3d79f83 track the kind of null arguments in order to provide the appropriate type when converting them 2024-07-11 15:06:55 -07:00
Nick Kocharhook
1e1697f655 Change to cfg!(not()) (#3275) 2024-07-11 15:03:18 -07:00
Nick Kocharhook
e565123ca3 Invert boolean for migrate error message. (#3275) 2024-07-11 15:03:18 -07:00
Joshua Potts
d1f180fbc5 fix: Minimally upgrade minimal dependencies to resolve build issues on declared minimum versions
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-07-11 11:59:15 -07:00
Joshua Potts
0546e0cfa9 ci: Add job to check that sqlx builds with its declared minimum dependencies
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-07-11 11:59:15 -07:00
Joshua Potts
ba1b2f9b82 refactor: Resolve cargo check warnings in postgres examples
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-07-10 22:15:31 -07:00
DirectorX
22e52c1171 allow rename with rename_all (close #2896) 2024-07-10 22:15:09 -07:00
Austin Bonander
16e3f1025a fix(postgres): add missing type resolution for arrays by name 2024-07-08 00:14:19 -07:00
Austin Bonander
efbf57265c fix: use correct syntax in tests/postgres/setup.sql 2024-07-08 00:14:19 -07:00
etorreborre
0eb2ee9365 feat: support the postgres bool type 2024-06-20 18:26:52 -07:00
alu
33aee07094 Remove compatibility check by collations. 2024-06-20 11:57:05 -07:00
alu
ce6d75208b Changed to collation which is the actual name. 2024-06-20 11:57:05 -07:00
Cristian Le
92de9d42a6 Add LICENSE-* files to crates 2024-06-20 10:56:08 -07:00
Lílian Ferreira de Freitas
402022df87 fix: use correct names for sslmode options
The names for the SSL mode options were incorrect, added test for making
sure the built url can be parsed to ensure internal consistency at
least. Also changed "ssl-mode" to "sslmode" as it seems more standard
and sqlx can parse both.
2024-06-15 11:59:31 -07:00
Austin Bonander
2618439663 fix(postgres): case-aware type name equality 2024-06-15 11:57:33 -07:00
Austin Bonander
32143363bc fix trailing line break 2024-06-15 11:57:33 -07:00
Austin Bonander
088a374ebb fix compilation errors 2024-06-15 11:57:33 -07:00
Austin Bonander
352310ba34 fix: run rustfmt 2024-06-15 11:57:33 -07:00
Austin Bonander
80359d1ada fix(postgres): derive PgHasArrayType for enums 2024-06-15 11:57:33 -07:00