launchbadge / sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.
Apache License 2.0
13.15k stars 1.24k forks source link

Can not disable Prepared statement in SqlX #3273

Closed groobyming closed 3 months ago

groobyming commented 3 months ago

Bug Description

When I use sqlx to connect to Doris, I get this error when trying to fetch the result: { source: Database(MySqlDatabaseError { code: Some("HY000"), number: 1105, message: "errCode = 2, detailMessage = Failed to prepare statementtry to set enable_server_side_prepared_statement = true" }) }

Is there a way to disable the "Prepared Statement"?

Minimal Reproduction

let mut con = MySqlConnection::connect("mysql://root:12345@localhost:9030/demo")
            .await.unwrap();
let result = sqlx::query("select * from demo.mytable limit 10").fetch(&mut con);
println!("result is {:?}", result)

Info

abonander commented 3 months ago

You can execute SQL without using a prepared statement with sqlx::raw_sql(). The rest of SQLx is designed heavily around prepared statements.