Skip to content

Commit 9d5ced3

Browse files
committed
Fix should_change_user for mysql 5.6
1 parent c5aa660 commit 9d5ced3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/conn/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,17 +1547,23 @@ mod test {
15471547
&["mysql_native_password"]
15481548
};
15491549

1550-
for plugin in plugins {
1550+
for (i, plugin) in plugins.iter().enumerate() {
15511551
let mut rng = rand::thread_rng();
15521552
let mut pass = [0u8; 10];
15531553
pass.try_fill(&mut rng).unwrap();
15541554
let pass: String = IntoIterator::into_iter(pass)
15551555
.map(|x| ((x % (123 - 97)) + 97) as char)
15561556
.collect();
15571557

1558-
conn.query_drop("DROP USER /*!50700 IF EXISTS */ /*M!100103 IF EXISTS */ __mats")
1559-
.await
1560-
.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+
}
15611567

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

0 commit comments

Comments
 (0)