Skip to content

preparing 0.5.8 release #1466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.5.8 - 2021-10-01

[A total of 24 pull requests][0.5.8-prs] were merged this release cycle! Some highlights:

* [[#1289]] Support the `immutable` option on SQLite connections [[@djmarcin]]
* [[#1295]] Support custom initial options for SQLite [[@ghassmo]]
* Allows specifying custom `PRAGMA`s and overriding those set by SQLx.
* [[#1345]] Initial support for Postgres `COPY FROM/TO`[[@montanalow], [@abonander]]
* [[#1439]] Handle multiple waiting results correctly in MySQL [[@eagletmt]]

[#1289]: https://github.com/launchbadge/sqlx/pull/1289
[#1295]: https://github.com/launchbadge/sqlx/pull/1295
[#1345]: https://github.com/launchbadge/sqlx/pull/1345
[#1439]: https://github.com/launchbadge/sqlx/pull/1439
[0.5.8-prs]: https://github.com/launchbadge/sqlx/pulls?q=is%3Apr+is%3Amerged+merged%3A2021-08-21..2021-10-01

## 0.5.7 - 2021-08-20

* [[#1392]] use `resolve_path` when getting path for `include_str!()` [[@abonander]]
Expand Down Expand Up @@ -967,4 +983,8 @@ Fix docs.rs build by enabling a runtime feature in the docs.rs metadata in `Carg
[@marshoepial]: https://github.com/marshoepial
[@link2ext]: https://github.com/link2ext
[@madadam]: https://github.com/madadam
[@AtkinsChang]: https://github.com/AtkinsChang
[@AtkinsChang]: https://github.com/AtkinsChang
[@djmarcin]: https://github.com/djmarcin
[@ghassmo]: https://github.com/ghassmo
[@eagletmt]: https://github.com/eagletmt
[@montanalow]: https://github.com/montanalow
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ members = [

[package]
name = "sqlx"
version = "0.5.7"
version = "0.5.8"
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/launchbadge/sqlx"
Expand Down
2 changes: 1 addition & 1 deletion sqlx-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqlx-cli"
version = "0.5.7"
version = "0.5.8"
description = "Command-line utility for SQLx, the Rust SQL toolkit."
edition = "2018"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion sqlx-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqlx-core"
version = "0.5.7"
version = "0.5.8"
repository = "https://github.com/launchbadge/sqlx"
description = "Core of SQLx, the rust SQL toolkit. Not intended to be used directly."
license = "MIT OR Apache-2.0"
Expand Down
5 changes: 4 additions & 1 deletion sqlx-core/src/any/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ impl Migrate for AnyConnection {
AnyConnectionKind::MySql(conn) => conn.revert(migration),

#[cfg(feature = "mssql")]
AnyConnectionKind::Mssql(_conn) => unimplemented!(),
AnyConnectionKind::Mssql(_conn) => {
let _ = migration;
unimplemented!()
}
}
}
}
25 changes: 24 additions & 1 deletion sqlx-core/src/postgres/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,32 @@ impl<C: DerefMut<Target = PgConnection>> PgCopyIn<C> {
})
}

/// Returns `true` if Postgres is expecting data in text or CSV format.
pub fn is_textual(&self) -> bool {
self.response.format == 0
}

/// Returns the number of columns expected in the input.
pub fn num_columns(&self) -> usize {
assert_eq!(
self.response.num_columns as usize,
self.response.format_codes.len(),
"num_columns does not match format_codes.len()"
);
self.response.format_codes.len()
}

/// Check if a column is expecting data in text format (`true`) or binary format (`false`).
///
/// ### Panics
/// If `column` is out of range according to [`.num_columns()`][Self::num_columns].
pub fn column_is_textual(&self, column: usize) -> bool {
self.response.format_codes[column] == 0
}

/// Send a chunk of `COPY` data.
///
/// If you're copying data from an `AsyncRead`, maybe consider [Self::copy_from] instead.
/// If you're copying data from an `AsyncRead`, maybe consider [Self::read_from] instead.
pub async fn send(&mut self, data: impl Deref<Target = [u8]>) -> Result<&mut Self> {
self.conn
.as_deref_mut()
Expand Down
3 changes: 2 additions & 1 deletion sqlx-core/src/postgres/types/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ impl TryFrom<&'_ Decimal> for PgNumeric {
type Error = BoxDynError;

fn try_from(decimal: &Decimal) -> Result<Self, BoxDynError> {
if decimal.is_zero() {
// `Decimal` added `is_zero()` as an inherent method in a more recent version
if Zero::is_zero(decimal) {
return Ok(PgNumeric::Number {
sign: PgNumericSign::Positive,
scale: 0,
Expand Down
2 changes: 1 addition & 1 deletion sqlx-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqlx-macros"
version = "0.5.7"
version = "0.5.8"
repository = "https://github.com/launchbadge/sqlx"
description = "Macros for SQLx, the rust SQL toolkit. Not intended to be used directly."
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion sqlx-rt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqlx-rt"
version = "0.5.7"
version = "0.5.8"
repository = "https://github.com/launchbadge/sqlx"
license = "MIT OR Apache-2.0"
description = "Runtime abstraction used by SQLx, the Rust SQL toolkit. Not intended to be used directly."
Expand Down
3 changes: 2 additions & 1 deletion tests/postgres/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ async fn it_can_abort_copy_in() -> anyhow::Result<()> {
)
.await?;

let mut copy = conn
let copy = conn
.copy_in_raw(
r#"
COPY users (id) FROM STDIN WITH (FORMAT CSV, HEADER);
Expand Down Expand Up @@ -1201,6 +1201,7 @@ async fn it_can_copy_out() -> anyhow::Result<()> {
Ok(())
}

#[sqlx_macros::test]
async fn test_issue_1254() -> anyhow::Result<()> {
#[derive(sqlx::Type)]
#[sqlx(type_name = "pair")]
Expand Down
2 changes: 1 addition & 1 deletion tests/sqlite/derives.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use sqlx::Sqlite;
use sqlx_test::{new, test_type};
use sqlx_test::test_type;

#[derive(Debug, PartialEq, sqlx::Type)]
#[repr(u32)]
Expand Down