1

In rust, I'm using mysql crate to make query with exec_first() function like this :

let query = r"SELECT NAME from MY_TABLE where VALUE=:age";
let datas = params!{"age"=> 2};
let reqres = pdb.conn.exec_first(query, datas)
    .expect("query failed")
    .expect("Can't get age"); 

dbg!(&reqres);

I understand this is the safe way to do it.

It works but, if I want to test the request in mysql> console, is there a way to print the datas interpolated request ?

1
  • You may enable General Log, execute from Rust, look the query in the log and execute it via CLI. Of course if Rust does not use PREPARE statement - in this case you'll see a pack of statements.. Commented Mar 19 at 13:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.