2138 Commits

Author SHA1 Message Date
Pekka Enberg
d23be3bfa8 Update libsqlite3-sys to 0.25.1 (#2094) 2023-02-21 13:25:25 -08:00
Daniel Tashjian
d00a543613 PgHasArrayType for transparent types fix. (#2086)
Problem: PgHasArrayType was checking the application's postgres feature
Solution: only check the library's postgres feature

Co-authored-by: Daniel Tashjian <daniel@ecomedes.com>
2023-02-21 13:25:25 -08:00
Austin Bonander
6d0d7402c8
fix(actions): quote glob branch filter 2023-02-03 14:18:01 -08:00
Austin Bonander
9d0e596740
Run CI on *-dev branch
I believe this has to be on `main` to actually take effect.
2023-02-03 14:16:53 -08:00
Chris Foster
c828fb5a19
Fixed typo. (#2156) 2023-02-01 16:54:18 -08:00
Austin Bonander
76ae286500
CHANGELOG: mention that users should upgrade CLI 2022-09-20 14:10:52 -07:00
Austin Bonander
ef17af31c2
fix: cannot publish with wildcard dep v0.6.2 2022-09-14 15:47:00 -07:00
Austin Bonander
b6cddcd014
prepare 0.6.2 release (#2092) 2022-09-14 15:23:06 -07:00
tyrelr
8fca76065a
Sqlite explain plan log efficiency (#2091)
* capture operation codes by reference

* use Vec instead of HashSet for results

* check logging enabled before cloning result
2022-09-12 18:22:15 -07:00
Adam Cigánek
f38c739f7f
fix: make begin,commit,rollback cancel-safe in sqlite (#2054) (#2057) 2022-09-12 18:20:27 -07:00
Travis Whitehead
09717e1b83
fix: Remove default chrono dep on time for sqlx-cli (#2089)
chrono v0.4.19 includes time 0.1 via default feature flag oldtime.
time 0.1 is deprecated and flagged for: https://rustsec.org/advisories/RUSTSEC-2020-0071
2022-09-12 18:08:39 -07:00
Marco Neumann
5e56da87e0
fix: ensure migration progress is not lost for PG, mysql and sqlite (#1991)
* fix: ensure migration progress is not lost for PG

Fixes #1966.

* fix: ensure migration progress is not lost for sqlite

This is similar to #1966.

* fix: ensure reverse migration progress is not lost for PG

See #1966.

* fix: ensure reverse migration progress is not lost for sqlite

See #1966.

* fix: ensure migration progress is not lost for mysql

This is similar to #1966.

* fix: ensure reverse migration progress is not lost for mysql

See #1966.

* test: check migration type as well

* test: extend migrations testing

* fix: work around MySQL implicit commits

* refactor: simplify migration testing
2022-09-12 17:52:04 -07:00
zz
ddffaa7dde
feat: Add try_from attribute for FromRow (#1081) 2022-09-06 21:04:11 -07:00
fuzzbuck
18a76fbdbf
customizable db locking during migration (#2063)
* customizable db locking during migration

* Update sqlx-core/src/migrate/migrator.rs

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

* [migrator.rs] cargo fmt

* fix Migrator 'locking' param doctest fail

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2022-09-06 13:42:56 -07:00
RustyYato
c5f3513f7d
Fix expansion of sqlx(flatten) (#2023)
Given a generic type like `A<B>` before `sqlx` would produce
`A<B>::from_row(row)` which is invalid syntax.
Now it produces `<A<B> as ::sqlx::FromRow<'a, R>>`.
This also fixes a bug for non-generic types where an inherent method
might have been called instead of the `::sqlx::FromRow::from_row` method
because UFCS wasn't used.
2022-09-02 17:52:05 -07:00
Rinat Shigapov
04884f1a1a
close unnamed portal after each executed extended query (#2081)
This allows to free server resources earlier and run the same logic as simple Query does:

"The simple Query message is approximately equivalent to the series Parse, Bind, portal Describe, Execute, Close, Sync,"
2022-09-02 17:49:31 -07:00
Richard Bradfield
20877d83fd
Add extension support for SQLite (#2062)
* Add extension support for SQLite

While SQLite supports loading extensions at run-time via either the C
API or the SQL interface, they strongly recommend [1] only enabling the C
API so that SQL injections don't allow attackers to run arbitrary
extension code.

Here we take the most conservative approach, we enable only the C
function, and then only when the user requests extensions be loaded in
their `SqliteConnectOptions`, and disable it again once we're done
loading those requested modules. We don't add any support for loading
extensions via environment variables or connection strings.

Extensions in the options are stored as an IndexMap as the load order
can have side effects, they will be loaded in the order they are
supplied by the caller.

Extensions with custom entry points are supported, but a default API
is exposed as most users will interact with extensions using the
defaults.

[1]: https://sqlite.org/c3ref/enable_load_extension.html

* Add extension testing for SQlite

Extends x.py to download an appropriate shared object file for supported
operating systems, and uses wget to fetch one into the GitHub Actions
context for use by CI.

Overriding LD_LIBRARY_PATH for only this specific DB minimises the
impact on the rest of the suite.
2022-09-01 15:03:27 -07:00
Tobias Tschinkowitz
9de70d2e7a
fix: mssql uses unsigned for tinyint instead of signed (#2074) 2022-08-31 18:10:29 -07:00
cycraig
20af5cd9c3
Use cargo check consistently in prepare (#2071) 2022-08-31 17:02:46 -07:00
cycraig
0823e1139c
Fix prepare race condition in workspaces (#2069)
* Separate offline query metadata per crate

* Update sqlx-cli prepare to use separate query metadata per crate

* Add resolve.root to metadata test fixture

* Simplify root package resolution

* Fix prepare --merged
2022-08-26 17:30:09 -07:00
amos
4c9d23960a
SqliteConnectOptions typo (#2072) 2022-08-26 15:45:32 -07:00
Rakshith Ravi
3f7111f05d
Updated documentation to reflect inet allows for IpAddr (#2053)
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2022-08-23 15:45:29 -07:00
Adam Cigánek
2d65c5de80
fix: use unlock notify also on sqlite3_exec (#2021) (#2055) 2022-08-22 20:01:48 -07:00
Austin Bonander
5790ffc8d3
fix(docs): close code block in query_builder.rs (#2067)
@danielakhterov and I were playing around with counting lines using regex and noticed that SQLx had an odd number of ` ``` ` and got a little nerd-sniped trying to find it.
2022-08-22 19:54:18 -07:00
Ophir LOJKINE
0e5b9a1bea
fix typo in documentation (#2058) 2022-08-17 17:17:12 -07:00
stoically
26f60d9525
chore: Switch to sha1 crate (#2056) 2022-08-16 17:51:29 -07:00
Austin Bonander
956d8a823a
chore: add Discord link to issue templates 2022-08-15 18:07:50 -07:00
Austin Bonander
e04045cd66
fix: change extension of .github/ISSUE_TEMPLATE/config.yaml to .yml
YAML was a mistake, honestly.
2022-08-15 17:39:42 -07:00
Austin Bonander
ad594ce5cb
Add FAQ and discussions links 2022-08-15 17:36:53 -07:00
Austin Bonander
5245c9e627
Add issue templates (#2052) 2022-08-15 17:35:30 -07:00
zach
326254fb51
Fix typo in FromRow docs (#2040)
Fixes typo: manuel to manual.
2022-08-11 14:24:57 -07:00
Marcus Lee
ca74b0c141
added flag for PIPES_AS_CONCAT connection setting for MySQL to fix #2034 (#2046) 2022-08-11 14:24:32 -07:00
Alexander Jackson
373b121a03
fix: use full macro path (#2028)
When the `#[sqlx::test]` macro is imported using `#[macro_use]` such as
in the following example:

```rust
extern crate sqlx;

mod tests {
    #[test]
    fn something() {}
}
```

then the `#[test]` generated by the macro will refer to itself instead
of the standard Rust `#[test]` macro. This will cause `rustc` to
recursively expand it and produce the following error message:

```
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
```

Instead, we can just refer to the standard macro by using its fully
qualified path.

This PR:
* Swaps `#[test]` usages in `#[sqlx::test]` for their hygenic path to
  prevent recursive expansion alongside `#[macro_use]`

Closes #2017.
2022-08-09 21:23:07 -07:00
NSMustache
c4f1816f76
Bump sqlformat to 0.2.0 (#2025)
Fixes #2024
2022-08-08 14:34:56 -07:00
szymek156
c931cab95f
Szymek156/issue2009 (#2014)
* SQLite: Execute SQLCipher pragmas as very first operations on the database

SQLCipher requires, apart from 'key' pragma also other cipher-related
to be executed before read/write to the database.

* Added tests for SQLCipher functionality

* remove default-features from libsqlite3-sys when building from dev-dependencies

Co-authored-by: Szymon Zimnowoda <szimnowoda.memri@gmail.com>
2022-08-05 12:20:14 -07:00
Austin Bonander
728717f032
docs(FAQ): add answer about supported db versions v0.6.1 2022-08-03 13:59:27 -07:00
Austin Bonander
7809ff4b86 fix(docs): remove mention of subcommand that wasn't added
I intended to add subcommands to `sqlx-cli` to manage test databases but I wanted to get #2001 finished and out the door so we can start using it ASAP.
2022-08-02 19:16:32 -07:00
Austin Bonander
cb52c7c62b chore: prep 0.6.1 release 2022-08-02 19:16:32 -07:00
Lining Pan
b630d5c748
feat: allow vfs to be set as uri query parameter (#2013)
* feat: allow vfs to be set as uri query parameter

* fix: handle VFS name as a string

* fix: avoid unnecessary copies of vfs name
2022-08-02 15:59:43 -07:00
Austin Bonander
054f61980a
feat: implement testing utilities (#2001) 2022-08-02 14:38:12 -07:00
Rob Ede
7adbb7fefc
refactor: remove direct actix-rt support (#1679)
actix- runtime feature flags are now aliases for tokio- flags
2022-08-01 21:48:40 -07:00
Austin Bonander
9a6d07f10a
feat: QueryBuilder improvements (#2005)
* get raw SQL
* method to build `QueryAs` instead of `Query`
2022-07-28 20:02:05 -07:00
Austin Bonander
a2eceec33b
chore: replace dotenv with dotenvy (#2003)
* chore: replace `dotenv` with `dotenvy`

The former appears to be unmaintained and the latter is a drop-in replacement.

* chore: fix all warnings
2022-07-28 14:33:44 -07:00
Marco Neumann
05d64fb722
fix: agree one a single default runtime for the whole workspace (#1988)
This fixes `cargo check --workspace` and rust-analyzer.

Also see <https://github.com/launchbadge/sqlx/discussions/1956>.
2022-07-28 13:15:40 -07:00
Marco Neumann
29073cbe84
fix: ensure PG connection is established before using it (#1989)
Fixes #1940.
2022-07-27 13:58:36 -07:00
うらむんオイル
5e08cd077e
docs: update versions (#1993) 2022-07-26 15:46:38 -07:00
Marco Neumann
58712ae552
docs: master -> main (#1990) 2022-07-21 19:06:16 -07:00
Erik
78a0a5943a
Add example for manual implemenation of the FromRow trait (#1495)
* chore: add doc example for manual implemenation of FromRow trait

* fix typo

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* chore: use `sqlx::Result` directly

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-07-19 14:31:10 -07:00
Vladimir
8fc4625ec7
Add push_bind_unseparated for Separated in query builder (#1985) 2022-07-19 00:10:33 -07:00
Austin Bonander
d7277f41eb
docs: clarify relationship between query_as! and FromRow (#1977) 2022-07-15 13:06:37 -07:00