Skip to content

Commit

Permalink
Fix should_change_user for mysql 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbeam committed Mar 19, 2024
1 parent c5aa660 commit 9d5ced3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/conn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,17 +1547,23 @@ mod test {
&["mysql_native_password"]
};

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

conn.query_drop("DROP USER /*!50700 IF EXISTS */ /*M!100103 IF EXISTS */ __mats")
.await
.unwrap();
let result = conn
.query_drop("DROP USER /*!50700 IF EXISTS */ /*M!100103 IF EXISTS */ __mats")
.await;
if matches!(conn.server_version(), (5, 6, _)) && i == 0 {
// IF EXISTS is not supported on 5.6 so the query will fail on the first iteration
drop(result);
} else {
result.unwrap();
}

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

0 comments on commit 9d5ced3

Please sign in to comment.