Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 110 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Note: should NOT increase during a minor/patch release cycle
[toolchain]
channel = "1.78"
channel = "1.88"
profile = "minimal"
8 changes: 8 additions & 0 deletions sqlx-mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ rust_decimal = { workspace = true, optional = true }
time = { workspace = true, optional = true }
uuid = { workspace = true, optional = true }

# Vendored patch: client-side parameter interpolation when
# `statement_cache_capacity == 0`. We use only `mysql_common::Value::as_sql`
# for canonical MySQL-client quoting/escaping. mysql_common's default
# features select a flate2 backend (required for it to compile); we unify
# flate2 to its pure-Rust `rust_backend` here so we don't pull in libz-sys.
mysql_common = { version = "0.37", default-features = false }
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }

# Misc
atoi = "2.0"
base64 = { version = "0.22.0", default-features = false, features = ["std"] }
Expand Down
16 changes: 15 additions & 1 deletion sqlx-mysql/src/connection/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,21 @@ impl MySqlConnection {
let mut columns = Arc::new(Vec::new());

let (mut column_names, format, mut needs_metadata) = if let Some(arguments) = arguments {
if persistent && self.inner.cache_statement.is_enabled() {
if !self.inner.cache_statement.is_enabled() {
// Vendored patch: when the prepared-statement cache is
// disabled, skip COM_STMT_PREPARE entirely. Interpolate
// bind values into the SQL and send a plain COM_QUERY.
let no_backslash_escape = self.inner.status_flags.contains(
Status::SERVER_STATUS_NO_BACKSLASH_ESCAPES,
);
let interpolated = super::text_query::interpolate(
sql,
&arguments,
no_backslash_escape,
)?;
self.inner.stream.send_packet(Query(&interpolated)).await?;
(Arc::default(), MySqlValueFormat::Text, true)
} else if persistent && self.inner.cache_statement.is_enabled() {
let (id, metadata) = self
.get_or_prepare_statement(sql)
.await?;
Expand Down
1 change: 1 addition & 0 deletions sqlx-mysql/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod auth;
mod establish;
mod executor;
mod stream;
mod text_query;
mod tls;

const MAX_PACKET_SIZE: u32 = 1024;
Expand Down
Loading