Commit graph

2050 commits

Author SHA1 Message Date
Toby Murray
24baac779f
Put Usage at same level as Install (#1814)
From a formatting perspective, `Usage` is currently nested under `Install`. I think these would appropriately be siblings. This has the side benefit of making the headings under `Usage` more visually distinct from the rest of the content which I think makes it easier to read.
2022-06-01 13:53:47 -07:00
smonv
4e3ff3644f
trim [ and ] from host string before used to connect by TcpStream (#1818) 2022-05-31 18:03:26 -07:00
Erik Rhodes
c744cb7f60
Avoid panic when streaming packets are empty (#1861)
* changed [] access to .get() to return result instead of panic

* changed error type to protocol err

* fixed issue with comparing ref

* cargo fmt

Co-authored-by: Erik Rhodes <erik@space-nav.com>
2022-05-31 17:58:49 -07:00
Oskar Persson
63291d677f
Fix nullability check for inner joins in postgres (#1863) 2022-05-31 17:58:38 -07:00
Scott Wey
5d91ffc81c
add COLLATE_UTF8MB4_0900_AI_CI (#1856) 2022-05-31 17:58:16 -07:00
Toby Murray
302b415897
Reword "building in offline mode" (#1815)
Sometimes people do a bad job of reading comprehension (see #1813). This rewords a little to be even more prescriptive about how to build in offline mode.
2022-05-31 16:59:37 -07:00
Michael Freeborn
1b9c40b3c8
fix serde_json usage in macros (#1842) 2022-05-31 16:58:11 -07:00
Michael Freeborn
a110e75b95
make methods pub (#1843) 2022-05-31 16:57:46 -07:00
Charles Samborski
d5f7e4288d
Fix panics on unknown Postgres type oid when decoding (#1855)
Postgres arrays and records do not fully support custom types. When encountering an unknown OID, they currently default to using `PgTypeInfo::with_oid`. This is invalid as it breaks the invariant that decoding only uses resolved types, leading to panics.

This commit returns an error instead of panicking. This is merely a mitigation: a proper fix would actually add full support for custom Postgres types. Full support involves more work, so it may still be useful to fix this immediate issue.

Related issues:
- https://github.com/launchbadge/sqlx/issues/1672
- https://github.com/launchbadge/sqlx/issues/1797
2022-05-31 16:57:16 -07:00
Keiji, Yoshimi
fbee0655e3
fix field is never read on postgres test (#1881) 2022-05-31 16:56:12 -07:00
Keiji, Yoshimi
56d5283ef4
fix "unused Result that must be used" warnings (#1882) 2022-05-31 16:55:59 -07:00
LovecraftianHorror
a2691b9635
Reuse a cached DB connection instead of always recreating for sqlx-macros (#1782)
* refactor: Reuse a cached connection instead of always recreating for `sqlx-macros`

* fix: Fix type inference issue when no database features used

* refactor: Switch cached db conn to an `AnyConnection`

* fix: Fix invalid variant name only exposed with features

* fix: Tweak connection options for SQLite with `sqlx-macros`

* fix: Remove read only option for SQLite connection

* fix: Fix feature flags regarding usage of `sqlx_core::any`
2022-05-25 18:22:09 -07:00
Dirkjan Ochtman
fa5c436918
Update crc to 3 (#1831) 2022-05-02 12:44:16 -07:00
LovecraftianHorror
826e63fc11
refactor(sqlx-macros): Ignore deps when getting metadata for workspace root (#1823) 2022-04-21 12:36:15 -07:00
Paolo Barbolini
ec15f6b30c
Update uuid crate to v1 (#1821) 2022-04-20 12:48:29 -07:00
Paolo Barbolini
b934f82440
Bump remanining dependencies (#1807)
Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-04-15 14:34:48 -07:00
Paolo Barbolini
fc9c9be5e8
Update to edition 2021 (#1808)
* Update to edition 2021

* Fix running tests
2022-04-15 12:52:00 -07:00
Austin Bonander
fee8c60fe0
document 0.5.13 in changelog 2022-04-15 12:34:05 -07:00
Sebastian Pütz
babd353c2c
Make PgLTree::push infallible and take PgLTreeLabel directly. (#1734)
* Make PgLTree::push infallible and take PgLTreeLabel directly.

Previously the function took strings and parsed them into
PgLTreeLabel internally, now it's possible to directlry push
PgLTreeLabels onto a PgLTree.

* Push PgLTree String conversion to label.

* rebase and fix compile error

Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-04-14 16:16:00 -07:00
Valentin
c7478dcc66
Update BigDecimal dependency (#1529)
* Update BigDecimal dependency

* rebase onto master

Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-04-14 16:12:15 -07:00
Atkins
17760d0f83
Move server_version_num from trait to impl (#1384)
* refactor(core): move `fn server_version_num` from `trait PgConnectionInfo` to impl

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* fix rebase issues

Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-04-14 16:02:08 -07:00
Paolo Barbolini
17fde443be
Bump ipnetwork to 0.19 (#1426)
* Bump ipnetwork to 0.18

* Bump ipnetwork to 0.19
2022-04-14 15:11:58 -07:00
Paolo Barbolini
ba123e62fa
Update time to 0.3.2 (#1455)
Co-authored-by: Tyler Hill <tyhi@tyhi.rs>
2022-04-14 15:11:46 -07:00
Paolo Barbolini
08296a28a0
Upgrade rustls to 0.20 (#1505)
* Upgrade rustls to 0.20

* Rustls 0.20.1 is out

* Fix merge conflict mistake

* Bump rustls-pemfile to 0.3

* Resync Cargo.lock

* Bump rustls-pemfile to v1

Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-04-14 15:11:17 -07:00
Paolo Barbolini
a97208c016
postgres: use Oid type everywhere instead of u32 (#1602)
* postgres: use Oid type instead of u32

* Make serde happy

* Expose the inner u32

* docs

* Try to fix tests

* Fix unit tests

* Fix order

* Not sure what happened here
2022-04-14 15:07:45 -07:00
05storm26
a68957b21f
Make all ConnectOptions clonable (#1612) 2022-04-14 15:07:29 -07:00
05storm26
f328cc15d8
Sqlite chrono::DateTime<FixedOffset> timezone fix (#1618) 2022-04-14 15:06:55 -07:00
Josh Triplett
342d157a50
Update git2 to 0.14 (#1733)
git2-rs recently updated major versions due to libgit2 doing the same.
Bump the version used in sqlx accordingly, to allow users of the new
git2 to use git2::Oid with sqlx.
2022-04-14 15:06:37 -07:00
Pruthvikar Reddy
cc1ab90110
Fix Rust type for SQLite REAL (#1785)
REAL is stored as as 8-byte IEEE floating point number
See https://www.sqlite.org/datatype3.html#storage_classes_and_datatypes
2022-04-14 15:05:38 -07:00
Austin Bonander
2e026cae67
prepare 0.5.12 release (#1800)
* prepare release 0.5.12

* chore: remove mentions of things happening in 0.6

except one mention that should still be happening in 0.6
2022-04-14 14:21:15 -07:00
Austin Bonander
6c7006c4cc
fix(pool): don't leak connections if drop task doesn't run (#1799)
fixes #1396
2022-04-13 16:39:07 -07:00
Sebastien Guillemot
973f3d154d
Fix newline parsing in pgpass (#1791)
* Fix newline parsing in pgpass

* test loading pgpass from a file

Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-04-13 14:58:34 -07:00
Austin Bonander
a46e370c94
feat: document and expand query builder (#1790)
elaborates on the API introduced in #1780
2022-04-12 13:22:47 -07:00
Paolo Barbolini
ccbbe102b2
Update RustCrypto crates (#1625)
* Update RustCrypto crates

* rsa bump

* rsa dump

* rsa bump

* Bump rsa to 0.6.0-pre crates.io release

* Bump hkdf

* Resync Cargo.lock

* Bump rsa to 0.6.0
2022-04-11 11:24:09 -07:00
crajcan
a470682572
Add Query builder (#1780)
* Add Query builder

* Make query_builder.rs in sqlx-core

* Add QueryBuilder::new()

* Add QueryBuilder::push()

* Define questions for documentation

* Get new, push, push_bind working with types

* Handle postgres' numbered bind varaibles

* Add a test for QueryBuilder#build

* Move arguments into Option

* Refactor query builder

* Finish testing QueryBuilder#build

* Remove design doc

* Add a test for pushing strings with push_bind

* Integration test green

* Adjust some tests

* Make query builder generic about placeholder segmenent ('$N' or '?')

* Run fmt

* Redesign Arguments#format_placeholder in line with code review

* Use write! to push sql to QueryBuilder

* Add QueryBuilder::reset to allow for QueryBuilder reuse

* Run cargo fmt
2022-04-08 13:36:42 -07:00
david-mcgillicuddy-moixa
6efc39f213
Include affected rows in logging even when query is done (#1754)
* fix logging bug

* slight code cleanup

* change to split rows affected and rows returned

* review comments, and small unreachable bug
2022-04-08 12:40:11 -07:00
Jérémie Drouet
0c95fdd19a
feat(migration): add function to undo migrations (#1675)
Right now, there is only a `run` function to programatically run the
migrations, which is great, but nothing to run the migrations down.

This function adds the possibility to undo the migrations until a
specific version (could say -1 or 0 to remove them all).

With this feature, it's now possible, in the end to end or integration
tests to run the migrations and undo them between each test set and
therefore test the migrations themselves.

This is the kind of feature that some ORM have like sequelize in nodejs
that allow you to undo migrations programatically.

Reference to the doc:
https://sequelize.org/v7/manual/migrations.html#undoing-migrations

Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
2022-04-07 16:03:00 -07:00
tyrelr
217dc55062
Fix #1249 Left joins in SQLite can break the query macros (#1789)
* Reproduce github issue#1249: Left joins in sqlite can break the query macros

* Fix panic caused by unknown cursor columns when executing NullRow command. Fixes #1249
2022-04-07 13:18:37 -07:00
Austin Bonander
f1c635d739
feat(pool): implement close-event notification (#1776)
fix(postgres): integrate pool close-event into `PgListener`

closes #1764
2022-04-05 16:17:35 -07:00
Andrew Whitehead
acb3da8a34
(mysql) silence warnings for unused fields (#1786)
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
2022-04-05 15:00:32 -07:00
Austin Bonander
dd2d51f207
fix(CHANGELOG): correct year for 0.5.11 release 2022-04-05 14:10:01 -07:00
Andrew Whitehead
040eb77d95
add FromStr, Copy, PartialEq, Eq impls for sqlite options (#1784)
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
2022-04-05 12:37:53 -07:00
Tomáš Drtina
f4ed7e6ee8
Added support all variants of NUMERIC[] using decimal feature like bigdecimal does. (#1781) 2022-04-04 13:54:25 -07:00
Austin Bonander
f8581386d2
feat(postgres): make extra_float_digits settable (#1774) 2022-04-01 14:51:29 -07:00
Pedro de Matos Fedricci
c30a4a5d88
Add --source for migration subcommands (#1769) 2022-04-01 12:19:51 -07:00
Rafael Ávila de Espíndola
d3093d0b70
Update libsqlite3-sys (#1763) 2022-03-28 15:04:49 -07:00
Austin Bonander
e1817f0a9d
feat: convenient wrapper for Postgres advisory locks (#1641) 2022-03-24 17:38:24 -07:00
Vladimir
9d76f7cd9e
Derive clone for mysql and mssql arguments (#1736) 2022-03-24 11:34:07 -07:00
Carol (Nichols || Goulding)
f5392151f3
Derive PgHasArrayType for transparent sqlx types (#1748)
Fixes #1744.
2022-03-23 16:41:36 -07:00
Ivan Petkov
1af26d8350
sqlx-core: impl Type for Cow<str> on Mssql, MySql, and Sqlite (#1757) 2022-03-23 12:31:43 -07:00