sqlx
sqlx copied to clipboard
MSSQL Query - Protocol unknown value
About
I'm new to rust, but I'm trying to create a simple async "driver" to use in python, so I'll connect via rust to access SQL Server and do statements and queries.
I´m trying
When trying to do a simple test of querying a 1000 row table with RUST.
Example
Code
use sqlx::mssql::MssqlPool;
use sqlx;
use sqlx::Error;
async fn query() -> Result<(), Error> {//Result<Vec<sqlx::mssql::MssqlRow>, Error> {
let conn_uri = "mssql://sa:Super&-23@localhost:1433/master";
let query = "
SELECT *
FROM TempTest
";
let conn = MssqlPool::connect(conn_uri).await?;
let rows = sqlx::query(query).fetch_all(&conn).await?;
println!("{}", rows.len());
Ok(())
}
#[tokio::main]
async fn main() -> Result<(), sqlx::Error> {
let _row = query().await?;
Ok(())
}
Error
Error: Protocol("unknown value `0x32` for message type in token stream")
Code + Data + Docker to reproduce the error.
I put in this repository the exact example I'm trying to run.
Link: https://github.com/carlos-rian/async-odbc-mssql/tree/main/core
I got the similar error when I used the mssql and sqlx version is 0.5.13.
I guest the reason is there are some fields which type is nvarchar(max). Try to change these fields type to the fixed number again. @carlos-rian
@hackers267 I understand, but this is a bug. I think it's a problem, right?
@carlos-rian I think it is a bug too. I will recover the code in the feature