-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Hey,
I'm trying to bind a variable to a query like so:
#[derive(sqlx::FromRow)]
struct Test {
BOOKING_TYPE_ID: String,
BOOKING_TYPE: String,
DESCRIPTION: String,
}
let row = sqlx::query_as::<_, Test>("SELECT * FROM BOOKING_TYPE WHERE DESCRIPTION = ?)
.bind("hio")
.fetch_one(&state.sql_pool).await.unwrap();
This produces invalid SQL. I've also tried {0}
and @p1
instead of ?
. I'm just not sure what the syntax is.
I've noticed there is different syntax for MySql and Postgres but I see no documentation on MSSQL. So:
- How do I bind to a query with MSSQL?
- Also, what Rust data type relates to MSSQL's uniqueidentifier (GUID)?
- I would be happy to contribute to the MSSQL documentation maybe with an example (I noticed there's only an example for MySql and Postgres)