You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an old request, and I have at last found some time to have a go at it, although the patch I am sharing below is incomplete and hackish at best. But it can help get the conversation started.
Basically, when the MySQL backend throws cppdb_error, we only get the error string reported by MySQL itself. Sometimes, at least for debugging purposes, it would be very convenient to get the full query, with or without the bound values for prepared statements.
As pointed out by Artyom in an earlier discussion, SQL queries can leak sensitive information, so it is understood that a developer would not leak such information to end users. Instead, dedicated calls can be made for debugging and logging purposes, for the use of the developer.
Anyway, I am not very competent, but I still had a go at it. The patch below is only a stub: it introduces new methods to cppdb_error to get the original statement, and the bound parameters. It's at best a work in progress, and parts of it are hackish, but it's enough for debugging purposes, and at least we get something that can be discussed and that can be improved on.
This is an old request, and I have at last found some time to have a go at it, although the patch I am sharing below is incomplete and hackish at best. But it can help get the conversation started.
Basically, when the MySQL backend throws cppdb_error, we only get the error string reported by MySQL itself. Sometimes, at least for debugging purposes, it would be very convenient to get the full query, with or without the bound values for prepared statements.
As pointed out by Artyom in an earlier discussion, SQL queries can leak sensitive information, so it is understood that a developer would not leak such information to end users. Instead, dedicated calls can be made for debugging and logging purposes, for the use of the developer.
Anyway, I am not very competent, but I still had a go at it. The patch below is only a stub: it introduces new methods to cppdb_error to get the original statement, and the bound parameters. It's at best a work in progress, and parts of it are hackish, but it's enough for debugging purposes, and at least we get something that can be discussed and that can be improved on.
error-show-full-query.patch.txt
Here is a sample usage:
The text was updated successfully, but these errors were encountered: