Commit graph

2191 commits

Author SHA1 Message Date
Austin Schey
cf3ce13d27 fix(prepare): store temporary query files inside the workspace 2023-03-14 17:25:24 -07:00
Gregor Giesen
70934d7cd2 Docs of FromRow -> skip attribute updated as suggested by @abonander
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-03-13 18:06:44 -07:00
Gregor Giesen
6713e8cdaa Docs for skip attribute of FromRow macro 2023-03-13 18:06:44 -07:00
Gregor Giesen
cc91986a42 fixed cargo format check 2023-03-13 18:06:44 -07:00
Gregor Giesen
03de69bcaa test for FromRow -> skip attribute 2023-03-13 18:06:44 -07:00
Gregor Giesen
665b859645 derive FromRow: added attribute skip for setting default value 2023-03-13 18:06:44 -07:00
Blair Noctis
c03926c741 fix: lower default logging level for statements to Debug 2023-03-10 17:58:14 -08:00
grantkee
aff632a9ec bump libsqlite3-sys to patched version 2023-03-10 14:37:09 -08:00
Daniel Beckwith
cea7228fe0 Remove invalid impl 2023-03-10 14:36:46 -08:00
Daniel Beckwith
0b192cfda6 Add From impls for Json 2023-03-10 14:36:46 -08:00
Vladimir
5a8cd959c2 fix test 2023-03-08 18:55:53 -08:00
Vladimir
4b8fa7a4d7 feat: support new types in sqlx::query_as! 2023-03-08 18:55:53 -08:00
Vladimir
d81b6fc08d fix: sqlx-postgres bigdecimal feature 2023-03-08 18:55:53 -08:00
Bram Geron
1ff6a2ac94 feat: support calling PostgreSQL procedures with the macros
Fixes #1449 (I think). I verified that the code fixes the new test.

I used INOUT in setup.sql because older versions of Postgres don't
support OUT parameters.
2023-03-03 19:36:39 -08:00
Nikhil Benesch
bb2baf2183 Don't run EXPLAIN nullability analysis on Materialize
Materialize [0] is a PostgreSQL-like database that, similar to
CockroachDB, does not support PostgreSQL's `EXPLAIN` output. Extend the
fix from PR #1248 to Materialize, too, so that sqlx can still be used
with Materialize.

See #1248.

[0]: https://materialize.com
2023-03-03 19:36:12 -08:00
Austin Bonander
c4b835c23a feat: add Connection::shrink_buffers, PoolConnection::close
closes #2372
2023-03-03 16:50:27 -08:00
Danilo Bargen
728280a2a3 README: Link build badge to workflow runs 2023-03-03 16:50:13 -08:00
Danilo Bargen
b61677d740 README: Fix build badge 2023-03-03 16:50:13 -08:00
Jayson Reis
82ff8d96b3 chore: Use tracing's fields to get structured logs
This also enables on services that can query this data to get useful metrics
2023-03-02 17:35:14 -08:00
Sergei Ivankov
21c2660062 Disable rustls crate logging feature by default 2023-03-01 19:17:35 -08:00
Craig Bester
3f2ec6f91a chore: update documentation to replace sqlx-data.json with .sqlx 2023-03-01 19:17:21 -08:00
Craig Bester
c6b372fdf0 chore: test macros' offline mode in CI
Co-authored-by: Austin Bonander <austin@launchbadge.com>
2023-03-01 19:17:21 -08:00
Craig Bester
96c8b12485 feat(prepare): move to one-file-per-query for offline mode
Co-authored-by: Jonas Platte <jonas@lumeo.com>
2023-03-01 19:17:21 -08:00
kenkoooo
291e79abae fix(docs): example code for sqlx::test 2023-03-01 19:12:00 -08:00
Austin Bonander
1fb1945aea fix(pool): close when last handle is dropped, extra check in try_acquire
closes #1928
closes #2375
2023-03-01 18:41:30 -08:00
Paolo Barbolini
c17c59fc4c Update dependencies 2023-02-22 15:49:46 -08:00
Craig Bester
9677430d67 fix: implement AnyConnectionBackend::as_migrate for databases 2023-02-22 15:09:41 -08:00
Craig Bester
a942f5316e fix: install default drivers before sqlx-cli create/drop 2023-02-22 15:09:41 -08:00
Craig Bester
006da611e1 fix: uncomment sqlx-cli database, default features 2023-02-22 15:09:41 -08:00
Austin Bonander
f05c884cdc
fix: remove readme entries for sqlx-mysql, sqlx-postgres, sqlx-sqlite 2023-02-21 15:44:03 -08:00
Austin Bonander
eade49cfb0
0.7.0-alpha.1 release 2023-02-21 14:56:54 -08:00
laundmo
c4a2e73a6f Add context to metadata parse error 2023-02-21 13:25:25 -08:00
Thibs
c4130d45e3 Add client SSL authentication using key-file for Postgres, MySQL and MariaDB (#1850)
* use native-tls API

* Add client cert and key to MySQL connector

* Add client ssl tests for PostgreSQL

* Add client ssl tests for MariaDB and MySQL

* Adapt GA tests

* Fix RUSTFLAGS to run all tests

* Remove containers to free the DB port before running SSL auth tests

* Fix CI bad naming

* Use docker-compose down to remove also the network

* Fix main rebase

* Stop trying to stop service using docker-compose, simply use docker cmd

* Fix RUSTFLAGS for Postgres

* Name the Docker images for MariaDB and MySQL so we can stop them using their name

* Add the exception for mysql 5.7 not supporting compatible TLS version with RusTLS

* Rebase fixes

* Set correctly tls struct (fix merge)

* Handle Elliptic Curve variant for private key

* Fix tests suite

* Fix features in CI

* Add tests for Postgres 15 + rebase

* Python tests: fix exception for MySQL 5.7 + remove unneeded for loops

* CI: run SSL tests only when building with TLS support

---------

Co-authored-by: Barry Simons <linuxuser586@gmail.com>
2023-02-21 13:25:25 -08:00
miles
1fd05716af [SQLite] Add option to execute PRAGMA optimize; on close of a connection (#2116)
* CHANGELOG: mention that users should upgrade CLI

* [SQLite] Add option to execute `PRAGMA optimize;` on close of a connection

* Update sqlx-sqlite/src/options/mod.rs

* Update sqlx-sqlite/src/options/mod.rs

* Update sqlx-sqlite/src/options/mod.rs

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-02-21 13:25:25 -08:00
Marco Cameriero
ab2ae26189 Postgres OID resolution query does not take into account current search_path (#2133)
* Fix oid resolution query

* Address review comments
2023-02-21 13:25:25 -08:00
Marco Cameriero
9f1f682285 Allow using complex types in try_from when deriving FromRow (#2115)
* Use `syn::Type` instead of `syn::Ident` to parse the value of `#[sqlx(try_from = "...")]`

* Fix broken test after rebase
2023-02-21 13:25:25 -08:00
Anthony Dodd
3440440564 Set whoami default-features to false (#2319)
* Fixed typo. (#2156)

* Set whoami default-features to false

Otherwise, whoami pulls in web-sys, wasm-bindgen and a BUNCH of
additional dependencies. This is really unnecessary, and if
someone has an actual use case where they are attempting to connect
to postgres from a browser, well ... they've probably already been
pwned by now. If it is deemed necessary, then add an additional
activation feature for that specific slew of deps.

---------

Co-authored-by: Chris Foster <cdbfoster@gmail.com>
2023-02-21 13:25:25 -08:00
Trangar
ad8ef8d608 Added regexp support in sqlite (#2189)
* CHANGELOG: mention that users should upgrade CLI

* Added regexp support in sqlite

* Added a with_regexp function to sqliteconnectoptions

* Fixed tests

* Undo CHANGELOG.md change

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Co-authored-by: Victor Koenders <victor.koenders@qrtech.se>
2023-02-21 13:25:25 -08:00
Paolo Barbolini
171b00de2e Start testing on Postgres 15 and drop Postgres 10 (#2193)
* CHANGELOG: mention that users should upgrade CLI

* Drop postgres 10 start testing postgres 15

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-02-21 13:25:25 -08:00
Andrés Felipe Quintero Moreano
0534c9da81 fix: ensures recover from fail with PgCopyIn (#2179)
* CHANGELOG: mention that users should upgrade CLI

* fix: ensures recover from fail with PgCopyIn

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-02-21 13:25:25 -08:00
CosmicHorror
acaee75a30 Initial work to switch to tracing (#2185)
* Add tracing dep

* Switch over basic events

* Switch over dynamically enabled events

* Fix missing SocketAddr formatting

* More format fixing

* refactor: Apply tracing changes to new crate structure
2023-02-21 13:25:25 -08:00
Danilo Cianfrone
b72a52b066 fix: use owned Builder pattern for ConnectOptions (#2132)
* CHANGELOG: mention that users should upgrade CLI

* fix(sqlx-core): use owned builder pattern for ConnectOptions

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-02-21 13:25:25 -08:00
Luiz Carvalho
c09532864d feat: better database errors (#2109)
* feat(core): create error kind enum

* feat(core): add error kind for postgres

* feat(core): add error kind for sqlite

* feat(core): add error kind for mysql

* test(postgres): add error tests

* test(sqlite): add error tests

* test(mysql): add error tests

* fix(tests): fix tests rebasing

* refac(errors): add `ErrorKind::Other` variant
2023-02-21 13:25:25 -08:00
OverHash
771ab80a62 Use let else statements in favor of macro (#2213) 2023-02-21 13:25:25 -08:00
Max Bruckner
092922e42a Expose PoolOptions for reading (#2113)
This allows reading back PoolOptions that have already been set.
2023-02-21 13:25:25 -08:00
tyrelr
5378dea6af Sqlite describe fixes (#2253)
* add failing test for nested orderby

* log query paths which were abandoned due to invalid state or looping.  Allow instructions to be executed a small number of times to fix nested order by query

* add failing testcase using nested orderby

* fix handling of sequence/offset and rewind

* fix handling when sqlite nests records inside of records

* add test of temporary table handling

* WIP add test failure for temp table access

* fix support for temp tables

* add tests for sqlite datetime functions

* add basic date and time function support

* handle gosub opcode correctly

* add group by test

* fix group by handling

* add additional passing group by test

* add test case for simple limit query

* fix IfPos & If touching wrong branches state, fix IfPos using wrong branch criteria

* add test for large offsets

* add short-circuit for possible query offset loops

* add groupby query that is predicted incorrectly

* fix handling of integer cast failures

* add tests for single-row aggregate results

* fix handling of null-based branching

* add test for coercion of text by sum

* fix calculation of sum value coercion

* add failing test for recursive with query

* add logic for delete operation to fix queries grouping by columns from a recursive query
2023-02-21 13:25:25 -08:00
Austin Bonander
b5312c3b6f Break drivers out into separate crates, clean up some technical debt (#2039)
* WIP rt refactors

* refactor: break drivers out into separate crates

also cleans up significant technical debt
2023-02-21 13:25:25 -08:00
tyrelr
f0d6924f92 avoid improper path merger if cursor backing register, or cursor emptiness is different (#2120) 2023-02-21 13:25:25 -08:00
Rongcui Dong
3cb8e07b44 Sqlite EXPLAIN type inference improvements (#1984)
* AggValue and ROW_NUMBER()

* Some more functions

* cargo fmt
2023-02-21 13:25:25 -08:00
Thomas Alton
42dd78fe93 feat: Add set_connect_options method to Pool (#2088)
* feat: Add set_connect_options method to Pool

This allows external updates of the ConnectionOptions used when a new
connection needs to be opened for the pool.  The primary use case
is to support dynamically updated (read: rotated) credentials used
by systems like AWS RDS.

* Use Arc wrapper for ConnectOptions to reduce lock contention

* sqlite fix

* Use direct assignment instead of mem::swap

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

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2023-02-21 13:25:25 -08:00