A service that provides the API to get the errors and warnings including fetching the warning, getting error/warning number, error/warning level, error/warning message, SQL state.
More...
|
mysql_service_status_t(* | affected_rows )(my_h_statement statement, uint64_t *num_rows) |
| Get the number of affected rows for DDL e.g. More...
|
|
mysql_service_status_t(* | insert_id )(my_h_statement statement, uint64_t *last_id) |
| Get the last insert id which is the ID generated for an AUTO_INCREMENT column. More...
|
|
mysql_service_status_t(* | error_number )(my_h_statement statement, uint64_t *error_number) |
| Get the error number of the last error. More...
|
|
mysql_service_status_t(* | error )(my_h_statement statement, mysql_cstring_with_length *error_message) |
| Get the error message of the last error. More...
|
|
mysql_service_status_t(* | sqlstate )(my_h_statement statement, mysql_cstring_with_length *sqlstate) |
| Get SQLSTATE error code for the last error similar to https://dev.mysql.com/doc/c-api/8.0/en/mysql-stmt-sqlstate.html. More...
|
|
mysql_service_status_t(* | num_warnings )(my_h_statement statement, uint32_t *count) |
| Get the number of warnings of the recently invoked statement. More...
|
|
mysql_service_status_t(* | get_warning )(my_h_statement statement, uint32_t warning_index, my_h_warning *warning) |
| Get the warning at the index. More...
|
|
mysql_service_status_t(* | warning_level )(my_h_warning warning, uint32_t *level) |
| Get the severity level of the warning. More...
|
|
mysql_service_status_t(* | warning_code )(my_h_warning warning, uint32_t *code) |
| Get the code of the warning. More...
|
|
mysql_service_status_t(* | warning_message )(my_h_warning warning, mysql_cstring_with_length *error_message) |
| Get the message of the warning. More...
|
|
A service that provides the API to get the errors and warnings including fetching the warning, getting error/warning number, error/warning level, error/warning message, SQL state.
In addition, for INSERT/UPDATE/DELETE, the service provides the API to get the number of affected rows and last insert ID.
Usage example: For INSERT/UPDATE/DELETE/... statements, to get the number of affected rows and last insert id.
uint64_t num_affected_rows;
SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->affected_rows(statement,
&num_affected_rows)
auto last_insert_id = uint64_t{};
SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->insert_id(statement,
&last_insert_id)
To get the diagnostics information auto error_number = uint64_t{}; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->error_id(statement, &error_number); char const *sql_errmsg = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->error(statement, &sql_errmsg); char const *sql_state = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->get_sql_state(statement, &sql_state); auto warning_count = uint32_t{}; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->num_warnings(statement, &warning_count);
for(size_t warn_index = 0; warn_index < warning_count; warn_index++) { my_h_warning warning = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->get_warning(statement, warn_index, &warning); auto level = uint32_t{}; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->warning_level(warning, &level);
Similarly for code and message }