Skip to content

Commit b85618e

Browse files
abonandermehcode
authored andcommitted
fix errors from .send_raw() additions that I didn't catch
1 parent 892a179 commit b85618e

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

sqlx-core/src/mysql/connection.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ use futures_util::AsyncWriteExt;
1111
use crate::{Describe, Error, io::{Buf, BufMut, BufStream}, mysql::{
1212
protocol::{
1313
Capabilities, ColumnCountPacket, ColumnDefinitionPacket, ComPing, ComQuit,
14-
ComStmtExecute, ComStmtPrepare, ComStmtPrepareOk, Encode, EofPacket, ErrPacket,
15-
OkPacket, ResultRow, StmtExecFlag,
14+
ComSetOption, ComStmtExecute,
15+
ComStmtPrepare, ComStmtPrepareOk, Encode, EofPacket, ErrPacket, OkPacket,
16+
ResultRow, SetOptionOptions, StmtExecFlag,
1617
},
1718
query::MySqlDbParameters,
1819
}, Result, ResultField, url::Url};
19-
20-
use super::establish;
2120
use crate::mysql::MySql;
2221
use crate::mysql::protocol::ComQuery;
2322

23+
use super::establish;
24+
2425
pub type StatementId = u32;
2526

2627
pub struct Connection {
@@ -311,10 +312,10 @@ impl Connection {
311312
async fn expect_eof_or_err(&mut self) -> crate::Result<()> {
312313
let packet = self.receive().await?;
313314

314-
match buf[0] {
315-
0xFE => EofPacket::decode(packet)?,
316-
0xFF => ErrPacket::decode(packet)?.expect_error()?,
317-
_ => return Err(protocol_err!("expected EOF or ERR, got {:02X}", buf[0]).into()),
315+
match packet[0] {
316+
0xFE => { EofPacket::decode(packet)?; },
317+
0xFF => { ErrPacket::decode(packet)?.expect_error()?; },
318+
_ => return Err(protocol_err!("expected EOF or ERR, got {:02X}", packet[0]).into()),
318319
}
319320

320321
Ok(())
@@ -337,7 +338,7 @@ impl Connection {
337338
let packet = self.receive().await?;
338339

339340
if packet[0] == 0xFF { return ErrPacket::decode(packet)?.expect_error() }
340-
/// otherwise ignore packet
341+
// otherwise ignore packet
341342

342343
self.expect_eof_or_err().await?;
343344

sqlx-core/src/mysql/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,6 @@ impl Executor for Connection {
154154
}
155155

156156
fn send<'e, 'q: 'e>(&'e mut self, commands: &'q str) -> BoxFuture<'e, crate::Result<()>> {
157-
unimplemented!()
157+
Box::pin(self.conn.send_raw(commands))
158158
}
159159
}

sqlx-core/src/mysql/protocol/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ pub use response::{
3030
ColumnCountPacket, ColumnDefinitionPacket, EofPacket, ErrPacket, OkPacket, ResultRow,
3131
};
3232
pub use server_status::ServerStatusFlag;
33-
pub use text::{ComDebug, ComInitDb, ComPing, ComProcessKill, ComQuery, ComQuit};
33+
pub use text::{ComDebug, ComInitDb, ComPing, ComProcessKill, ComQuery, ComQuit, ComSetOption, SetOptionOptions};

sqlx-core/src/pool/executor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ where
5454
) -> BoxFuture<'e, crate::Result<Describe<Self::Backend>>> {
5555
Box::pin(async move { <&Pool<DB> as Executor>::describe(&mut &*self, query).await })
5656
}
57+
58+
fn send<'e, 'q: 'e>(&'e mut self, commands: &'q str) -> BoxFuture<'e, crate::Result<()>> {
59+
Box::pin(async move { <&Pool<DB> as Executor>::send(&mut &*self, commands).await })
60+
}
5761
}
5862

5963
impl<DB> Executor for &'_ Pool<DB>
@@ -107,6 +111,6 @@ where
107111
}
108112

109113
fn send<'e, 'q: 'e>(&'e mut self, commands: &'q str) -> BoxFuture<'e, crate::Result<()>> {
110-
Box::pin(async move { self.acquire().await?.batch_exec(commands).await })
114+
Box::pin(async move { self.acquire().await?.send(commands).await })
111115
}
112116
}

0 commit comments

Comments
 (0)