Skip to content

Commit 5a807d9

Browse files
authored
Merge pull request #297 from blackbeam/v0.34-release
v0.34 release
2 parents 116fa6d + 9d5ced3 commit 5a807d9

File tree

8 files changed

+180
-86
lines changed

8 files changed

+180
-86
lines changed

Cargo.toml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ license = "MIT/Apache-2.0"
77
name = "mysql_async"
88
readme = "README.md"
99
repository = "https://github.com/blackbeam/mysql_async"
10-
version = "0.33.0"
10+
version = "0.34.0"
1111
exclude = ["test/*"]
12-
edition = "2018"
12+
edition = "2021"
1313
categories = ["asynchronous", "database"]
1414

1515
[dependencies]
@@ -23,7 +23,7 @@ keyed_priority_queue = "0.4"
2323
lazy_static = "1"
2424
lru = "0.12.0"
2525
mio = { version = "0.8.0", features = ["os-poll", "net"] }
26-
mysql_common = { version = "0.31", default-features = false }
26+
mysql_common = { version = "0.32", default-features = false }
2727
once_cell = "1.7.2"
2828
pem = "3.0"
2929
percent-encoding = "2.1.0"
@@ -42,7 +42,7 @@ twox-hash = "1"
4242
url = "2.1"
4343

4444
[dependencies.tokio-rustls]
45-
version = "0.24.0"
45+
version = "0.25"
4646
optional = true
4747

4848
[dependencies.tokio-native-tls]
@@ -54,12 +54,12 @@ version = "0.2"
5454
optional = true
5555

5656
[dependencies.rustls]
57-
version = "0.21.0"
58-
features = ["dangerous_configuration"]
57+
version = "0.22.2"
58+
features = []
5959
optional = true
6060

6161
[dependencies.rustls-pemfile]
62-
version = "1.0.1"
62+
version = "2.1.0"
6363
optional = true
6464

6565
[dependencies.webpki]
@@ -68,7 +68,7 @@ features = ["std"]
6868
optional = true
6969

7070
[dependencies.webpki-roots]
71-
version = "0.25.0"
71+
version = "0.26.1"
7272
optional = true
7373

7474
[dev-dependencies]
@@ -80,38 +80,56 @@ tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread"] }
8080
[features]
8181
default = [
8282
"flate2/zlib",
83-
"mysql_common/bigdecimal",
84-
"mysql_common/rust_decimal",
85-
"mysql_common/time",
86-
"mysql_common/frunk",
83+
"bigdecimal",
84+
"rust_decimal",
85+
"time",
86+
"frunk",
8787
"derive",
8888
"native-tls-tls",
8989
"binlog",
9090
]
91+
9192
default-rustls = [
9293
"flate2/rust_backend",
93-
"mysql_common/bigdecimal",
94-
"mysql_common/rust_decimal",
95-
"mysql_common/time",
96-
"mysql_common/frunk",
94+
"bigdecimal",
95+
"rust_decimal",
96+
"time",
97+
"frunk",
9798
"derive",
9899
"rustls-tls",
99100
"binlog",
100101
]
102+
103+
# minimal feature set with system flate2 impl
101104
minimal = ["flate2/zlib"]
105+
# minimal feature set with rust flate2 impl
106+
minimal-rust = ["flate2/rust_backend"]
107+
108+
# native-tls based TLS support
102109
native-tls-tls = ["native-tls", "tokio-native-tls"]
110+
111+
# rustls based TLS support
103112
rustls-tls = [
104113
"rustls",
105114
"tokio-rustls",
106115
"webpki",
107116
"webpki-roots",
108117
"rustls-pemfile",
109118
]
110-
tracing = ["dep:tracing"]
119+
120+
# mysql_common features
111121
derive = ["mysql_common/derive"]
112-
nightly = []
122+
chrono = ["mysql_common/chrono"]
123+
time = ["mysql_common/time"]
124+
bigdecimal = ["mysql_common/bigdecimal"]
125+
rust_decimal = ["mysql_common/rust_decimal"]
126+
frunk = ["mysql_common/frunk"]
113127
binlog = ["mysql_common/binlog"]
114128

129+
# other features
130+
tracing = ["dep:tracing"]
131+
nightly = []
132+
115133
[lib]
116134
name = "mysql_async"
117135
path = "src/lib.rs"

azure-pipelines.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ jobs:
9494
maxParallel: 10
9595
matrix:
9696
v80:
97-
DB_VERSION: "8-debian"
97+
DB_VERSION: "8.0-debian"
9898
v57:
99-
DB_VERSION: "5-debian"
99+
DB_VERSION: "5.7-debian"
100100
v56:
101101
DB_VERSION: "5.6"
102102
steps:
@@ -114,9 +114,13 @@ jobs:
114114
displayName: Run MySql in Docker
115115
- bash: |
116116
docker exec container bash -l -c "mysql -uroot -ppassword -e \"SET old_passwords = 1; GRANT ALL PRIVILEGES ON *.* TO 'root2'@'%' IDENTIFIED WITH mysql_old_password AS 'password'; SET PASSWORD FOR 'root2'@'%' = OLD_PASSWORD('password')\"";
117+
docker exec container bash -l -c "echo 'deb [trusted=yes] http://archive.debian.org/debian/ stretch main non-free contrib' > /etc/apt/sources.list"
118+
docker exec container bash -l -c "echo 'deb-src [trusted=yes] http://archive.debian.org/debian/ stretch main non-free contrib ' >> /etc/apt/sources.list"
119+
docker exec container bash -l -c "echo 'deb [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main non-free contrib' >> /etc/apt/sources.list"
120+
docker exec container bash -l -c "echo 'deb [trusted=yes] http://repo.mysql.com/apt/debian/ stretch mysql-5.6' > /etc/apt/sources.list.d/mysql.list"
117121
condition: eq(variables['DB_VERSION'], '5.6')
118122
- bash: |
119-
docker exec container bash -l -c "apt-get update"
123+
docker exec container bash -l -c "apt-get --allow-unauthenticated -y update"
120124
docker exec container bash -l -c "apt-get install -y curl clang libssl-dev pkg-config build-essential"
121125
docker exec container bash -l -c "curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable"
122126
displayName: Install Rust in docker
@@ -138,20 +142,16 @@ jobs:
138142
strategy:
139143
maxParallel: 10
140144
matrix:
141-
v107:
142-
DB_VERSION: "10.7"
145+
v113:
146+
DB_VERSION: "11.3"
147+
v1011:
148+
DB_VERSION: "10.11"
143149
v106:
144150
DB_VERSION: "10.6"
145151
v105:
146152
DB_VERSION: "10.5"
147153
v104:
148154
DB_VERSION: "10.4"
149-
v103:
150-
DB_VERSION: "10.3"
151-
v102:
152-
DB_VERSION: "10.2"
153-
v101:
154-
DB_VERSION: "10.1"
155155
steps:
156156
- bash: |
157157
sudo apt-get update

src/conn/mod.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// modified, or distributed except according to those terms.
88

99
use futures_util::FutureExt;
10-
pub use mysql_common::named_params;
1110

1211
use mysql_common::{
1312
constants::{DEFAULT_MAX_ALLOWED_PACKET, UTF8MB4_GENERAL_CI, UTF8_GENERAL_CI},
@@ -575,6 +574,10 @@ impl Conn {
575574
Some(self.inner.auth_plugin.borrow()),
576575
self.capabilities(),
577576
Default::default(), // TODO: Add support
577+
self.inner
578+
.opts
579+
.max_allowed_packet()
580+
.unwrap_or(DEFAULT_MAX_ALLOWED_PACKET) as u32,
578581
);
579582

580583
// Serialize here to satisfy borrow checker.
@@ -1544,17 +1547,23 @@ mod test {
15441547
&["mysql_native_password"]
15451548
};
15461549

1547-
for plugin in plugins {
1550+
for (i, plugin) in plugins.iter().enumerate() {
15481551
let mut rng = rand::thread_rng();
15491552
let mut pass = [0u8; 10];
15501553
pass.try_fill(&mut rng).unwrap();
15511554
let pass: String = IntoIterator::into_iter(pass)
15521555
.map(|x| ((x % (123 - 97)) + 97) as char)
15531556
.collect();
15541557

1555-
conn.query_drop("DROP USER /*!50700 IF EXISTS */ /*M!100103 IF EXISTS */ __mats")
1556-
.await
1557-
.unwrap();
1558+
let result = conn
1559+
.query_drop("DROP USER /*!50700 IF EXISTS */ /*M!100103 IF EXISTS */ __mats")
1560+
.await;
1561+
if matches!(conn.server_version(), (5, 6, _)) && i == 0 {
1562+
// IF EXISTS is not supported on 5.6 so the query will fail on the first iteration
1563+
drop(result);
1564+
} else {
1565+
result.unwrap();
1566+
}
15581567

15591568
if conn.inner.is_mariadb || conn.server_version() < (5, 7, 0) {
15601569
if matches!(conn.server_version(), (5, 6, _)) {

src/error/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
pub use url::ParseError;
1010

11-
mod tls;
11+
pub mod tls;
1212

1313
use mysql_common::{
1414
named_params::MixedParamsError, params::MissingNamedParameterError,
@@ -243,7 +243,10 @@ impl From<mysql_common::packets::ServerError<'_>> for ServerError {
243243
ServerError {
244244
code: packet.error_code(),
245245
message: packet.message_str().into(),
246-
state: packet.sql_state_str().into(),
246+
state: packet
247+
.sql_state_ref()
248+
.map(|s| s.as_str().into_owned())
249+
.unwrap_or_else(|| "HY000".to_owned()),
247250
}
248251
}
249252
}

src/error/tls/rustls_error.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
use std::fmt::Display;
44

5+
use rustls::server::VerifierBuilderError;
6+
57
#[derive(Debug)]
68
pub enum TlsError {
79
Tls(rustls::Error),
810
Pki(webpki::Error),
911
InvalidDnsName(webpki::InvalidDnsNameError),
12+
VerifierBuilderError(VerifierBuilderError),
1013
}
1114

1215
impl From<TlsError> for crate::Error {
@@ -15,6 +18,12 @@ impl From<TlsError> for crate::Error {
1518
}
1619
}
1720

21+
impl From<VerifierBuilderError> for TlsError {
22+
fn from(e: VerifierBuilderError) -> Self {
23+
TlsError::VerifierBuilderError(e)
24+
}
25+
}
26+
1827
impl From<rustls::Error> for TlsError {
1928
fn from(e: rustls::Error) -> Self {
2029
TlsError::Tls(e)
@@ -57,6 +66,7 @@ impl std::error::Error for TlsError {
5766
TlsError::Tls(e) => Some(e),
5867
TlsError::Pki(e) => Some(e),
5968
TlsError::InvalidDnsName(e) => Some(e),
69+
TlsError::VerifierBuilderError(e) => Some(e),
6070
}
6171
}
6272
}
@@ -67,6 +77,7 @@ impl Display for TlsError {
6777
TlsError::Tls(e) => e.fmt(f),
6878
TlsError::Pki(e) => e.fmt(f),
6979
TlsError::InvalidDnsName(e) => e.fmt(f),
80+
TlsError::VerifierBuilderError(e) => e.fmt(f),
7081
}
7182
}
7283
}

0 commit comments

Comments
 (0)