Commit graph

2034 commits

Author SHA1 Message Date
Austin Bonander
b532eb3373
chore: test macros' offline mode in CI 2022-04-14 16:22:27 -07:00
Jonas Platte
1fa2381015
feat(macros): move to one-file-per-query for offline mode
Query data is now stored in .sqlx/{query_hash}.json directly by the macro
invocations, rather than first writing to target/sqlx/{input_span_hash}.json
and then collecting those into sqlx-data.json separately.
2022-04-14 16:22:25 -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
Grachev Mikhail
78dc0ad811
docs(query_as): fix link (#1761) 2022-03-23 12:16:44 -07:00
Grachev Mikhail
3b1801b585
Fix typo in TSTZRANGE (#1741) 2022-03-09 17:54:44 -06:00
Dylan DPC
b40a86ceb7
Update Cargo.toml (#1738) 2022-03-09 11:57:37 -06:00
LovecraftianHorror
feff96c460
fix(sqlx-cli): pass the DATABASE_URL to command spawned for sqlx-macros (#1735) 2022-03-09 10:24:00 -06:00
liushuyu
dfd9cf59f1
fix(postgres): fix option passing logic (#1731)
Co-authored-by: Austin Bonander <austin@launchbadge.com>

Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-03-01 21:29:38 -08:00
Paolo Barbolini
5b85a034da
Update heck to 0.4 (#1725) 2022-02-28 15:51:50 -08:00
Andre B. Reis
99d3220d88
Impl PgHasArrayType for serde_json::{Value,RawValue} (#1722)
* Implement PgHasArrayType for JSON types in the serde_json crate

* Remove redundant Type impls for arrays and Vecs of JsonValue

* Relax an implicit Sized bound to support JsonRawValue
2022-02-23 12:57:48 -08:00
Malhar Vora
cc35809708
Address #1718 (#1719)
Fix broken link
2022-02-22 12:16:43 -08:00
Austin Bonander
eaf41fd092
prepare 0.5.11 release (#1715) 2022-02-18 13:49:06 -08:00
Bastian
dd39e79f8a
Support for lquery (#1710)
* initial lquery version

* share code between ltree/lquery

* more lquery functions

* fix rebase issues

* add version comment

* Update sqlx-core/src/postgres/types/lquery.rs

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

Co-authored-by: Bastian Schubert <bastian.schubert@crosscard.com>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2022-02-17 15:06:35 -08:00
05storm26
8bccd53346
Allow converting AnyConnectOptions to a specific ConnectOptions (#1610) 2022-02-17 14:57:48 -08:00
stoically
45854a4246
docs: Acquire examples and alternative (#1687) 2022-02-17 14:55:38 -08:00
Matthias Hörmann
fd4d219c66
fix and extend postgres transaction example (#1636) 2022-02-16 19:05:31 -08:00
Andrew Wheeler(Genusis)
183e620381
Implement From for AnyConnection (#1652)
* Implemented From for AnyConnection to cover the 4 Database type connections to AnyConnection

* formatting
2022-02-16 18:59:32 -08:00
Fredrik Park
e7a50d3501
Document Offline mode with feature flags (#1665)
I ran into this and found the solution inside of this issue https://github.com/launchbadge/sqlx/issues/1593
Fixes #1593
2022-02-15 21:14:04 -08:00
k-jun
c90d2714ff
docs(macros): remove sentences banning usage of as _ (#1619)
* docs(macros): remove sentents banning `as _`

* fix(macros): comment

* Update src/macros.rs

* Update src/macros.rs

Co-authored-by: keijun-kumagai <keijun.kumagai@dena.com>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2022-02-15 21:13:39 -08:00