preparing 0.5.8 release (#1466)

* preparing 0.5.8 release

* fix warnings before release
This commit is contained in:
Austin Bonander 2021-10-01 14:45:25 -07:00 committed by GitHub
parent efde5c507f
commit 1b5dd6514b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 64 additions and 16 deletions

View file

@ -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/), 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). 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 ## 0.5.7 - 2021-08-20
* [[#1392]] use `resolve_path` when getting path for `include_str!()` [[@abonander]] * [[#1392]] use `resolve_path` when getting path for `include_str!()` [[@abonander]]
@ -968,3 +984,7 @@ Fix docs.rs build by enabling a runtime feature in the docs.rs metadata in `Carg
[@link2ext]: https://github.com/link2ext [@link2ext]: https://github.com/link2ext
[@madadam]: https://github.com/madadam [@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
Cargo.lock generated
View file

@ -2333,7 +2333,7 @@ dependencies = [
[[package]] [[package]]
name = "sqlx" name = "sqlx"
version = "0.5.7" version = "0.5.8"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-std", "async-std",
@ -2366,7 +2366,7 @@ dependencies = [
[[package]] [[package]]
name = "sqlx-cli" name = "sqlx-cli"
version = "0.5.7" version = "0.5.8"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -2389,7 +2389,7 @@ dependencies = [
[[package]] [[package]]
name = "sqlx-core" name = "sqlx-core"
version = "0.5.7" version = "0.5.8"
dependencies = [ dependencies = [
"ahash", "ahash",
"atoi", "atoi",
@ -2526,7 +2526,7 @@ dependencies = [
[[package]] [[package]]
name = "sqlx-macros" name = "sqlx-macros"
version = "0.5.7" version = "0.5.8"
dependencies = [ dependencies = [
"dotenv", "dotenv",
"either", "either",
@ -2546,7 +2546,7 @@ dependencies = [
[[package]] [[package]]
name = "sqlx-rt" name = "sqlx-rt"
version = "0.5.7" version = "0.5.8"
dependencies = [ dependencies = [
"actix-rt", "actix-rt",
"async-native-tls", "async-native-tls",

View file

@ -18,7 +18,7 @@ members = [
[package] [package]
name = "sqlx" name = "sqlx"
version = "0.5.7" version = "0.5.8"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
readme = "README.md" readme = "README.md"
repository = "https://github.com/launchbadge/sqlx" repository = "https://github.com/launchbadge/sqlx"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "sqlx-cli" name = "sqlx-cli"
version = "0.5.7" version = "0.5.8"
description = "Command-line utility for SQLx, the Rust SQL toolkit." description = "Command-line utility for SQLx, the Rust SQL toolkit."
edition = "2018" edition = "2018"
readme = "README.md" readme = "README.md"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "sqlx-core" name = "sqlx-core"
version = "0.5.7" version = "0.5.8"
repository = "https://github.com/launchbadge/sqlx" repository = "https://github.com/launchbadge/sqlx"
description = "Core of SQLx, the rust SQL toolkit. Not intended to be used directly." description = "Core of SQLx, the rust SQL toolkit. Not intended to be used directly."
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"

View file

@ -223,7 +223,10 @@ impl Migrate for AnyConnection {
AnyConnectionKind::MySql(conn) => conn.revert(migration), AnyConnectionKind::MySql(conn) => conn.revert(migration),
#[cfg(feature = "mssql")] #[cfg(feature = "mssql")]
AnyConnectionKind::Mssql(_conn) => unimplemented!(), AnyConnectionKind::Mssql(_conn) => {
let _ = migration;
unimplemented!()
}
} }
} }
} }

View file

@ -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. /// 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> { pub async fn send(&mut self, data: impl Deref<Target = [u8]>) -> Result<&mut Self> {
self.conn self.conn
.as_deref_mut() .as_deref_mut()

View file

@ -88,7 +88,8 @@ impl TryFrom<&'_ Decimal> for PgNumeric {
type Error = BoxDynError; type Error = BoxDynError;
fn try_from(decimal: &Decimal) -> Result<Self, 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 { return Ok(PgNumeric::Number {
sign: PgNumericSign::Positive, sign: PgNumericSign::Positive,
scale: 0, scale: 0,

View file

@ -1,6 +1,6 @@
[package] [package]
name = "sqlx-macros" name = "sqlx-macros"
version = "0.5.7" version = "0.5.8"
repository = "https://github.com/launchbadge/sqlx" repository = "https://github.com/launchbadge/sqlx"
description = "Macros for SQLx, the rust SQL toolkit. Not intended to be used directly." description = "Macros for SQLx, the rust SQL toolkit. Not intended to be used directly."
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "sqlx-rt" name = "sqlx-rt"
version = "0.5.7" version = "0.5.8"
repository = "https://github.com/launchbadge/sqlx" repository = "https://github.com/launchbadge/sqlx"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Runtime abstraction used by SQLx, the Rust SQL toolkit. Not intended to be used directly." description = "Runtime abstraction used by SQLx, the Rust SQL toolkit. Not intended to be used directly."

View file

@ -1148,7 +1148,7 @@ async fn it_can_abort_copy_in() -> anyhow::Result<()> {
) )
.await?; .await?;
let mut copy = conn let copy = conn
.copy_in_raw( .copy_in_raw(
r#" r#"
COPY users (id) FROM STDIN WITH (FORMAT CSV, HEADER); COPY users (id) FROM STDIN WITH (FORMAT CSV, HEADER);
@ -1201,6 +1201,7 @@ async fn it_can_copy_out() -> anyhow::Result<()> {
Ok(()) Ok(())
} }
#[sqlx_macros::test]
async fn test_issue_1254() -> anyhow::Result<()> { async fn test_issue_1254() -> anyhow::Result<()> {
#[derive(sqlx::Type)] #[derive(sqlx::Type)]
#[sqlx(type_name = "pair")] #[sqlx(type_name = "pair")]

View file

@ -1,5 +1,5 @@
use sqlx::Sqlite; use sqlx::Sqlite;
use sqlx_test::{new, test_type}; use sqlx_test::test_type;
#[derive(Debug, PartialEq, sqlx::Type)] #[derive(Debug, PartialEq, sqlx::Type)]
#[repr(u32)] #[repr(u32)]