-
Notifications
You must be signed in to change notification settings - Fork 133
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
Extract the type of error #163
Comments
Hi,
Not directly, no, but the modification isn’t difficult. You could simply write a special handler as part of parse_error_packet(), add code to execute_query(), or add a function to return the error number (best solution).
Dr. Bell
Hint (warning: not tested):
…--- /Users/cbell/source/MySQL_Connector_Arduino/src/MySQL_Cursor.h 2020-09-03 15:37:28.000000000 -0400
+++ ./MySQL_Cursor.h 2021-01-04 14:04:20.000000000 -0500
@@ -79,6 +79,7 @@
void show_results();
int get_rows_affected() { return rows_affected; }
int get_last_insert_id() { return last_insert_id; }
+ int get_error() { return conn->read_int(5, 2); }
#endif
private:
And in your sketch, do something like this (again, not tested):
if (!cur.execute(query)) {
If (cur.get_error() == 75) {
Serial.println(“My custom error. “);
} else {
Serial.print(“ERROR: Wonkification in progress. Error code=“);
Serial.println(cur.get_error());
}
}
On Jan 4, 2021, at 1:31 PM, quakef4 ***@***.***> wrote:
Hello,
I would need to memorize the type of error within a variable:
Example this:
Error: 75 = Deadlock found when trying to get lock; try restarting transaction.
in this case, I would need to memorize the number 75 inside a variable.
Is this possible without making changes to the library?
Thanks in advance!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#163>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB6SHYBOMZJZYVY7JYNLOXLSYICOZANCNFSM4VTMKLXQ>.
|
Yeah! it work fine! |
On my list, yes. :)
…On Mon, Jan 4, 2021 at 14:40 quakef4 ***@***.***> wrote:
Reopened #163
<#163>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#163 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB6SHYDGCYH5KBUM45UUBQTSYIKUTANCNFSM4VTMKLXQ>
.
|
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I would need to memorize the type of error within a variable:
Example this:
Error: 75 = Deadlock found when trying to get lock; try restarting transaction.
in this case, I would need to memorize the number 75 inside a variable.
Is this possible without making changes to the library?
Thanks in advance!
The text was updated successfully, but these errors were encountered: