-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to query the executed sql statement #386
Comments
Hi. Sorry but I couldn't parse the meaning of the question. If you need query log consider looking into MySql documentation — this is from the top of google results. |
The interaction with the mysql database is carried out through sql statements
The parameters passed to the exec_first method here are sql and sql_data. Now I want to know what the complete sql statement generated by these two parameters is, so as to facilitate the viewing and debugging of errors |
Oh, I see. Prepared statements does not work In a way that "complete SQL statement" is constructed from
|
A combination like the above will report an error: So I want to see what the sql statement exec_first is like |
"Prepared statements" is not a trivial template language where all the Things you should note:
This version should work: conn.exec_first("SELECT * FROM `company` WHERE `name` LIKE ?", ("%200key%",))?; |
@blackbeam I know it's not this repo's job to document mysql, but your above example is so helpful and I too was confused about how to mix prepared statements with For what it's worth, consider adding your example to the readme on prepared statements, as the current example is a bit trivial and it almost never hurts listing more than just 1 example ;) |
Question: How do I query the sql statements executed by exec_first
The text was updated successfully, but these errors were encountered: