Hi there,
In some situations it would come in handy if there was also a numeric error code from the DB layer.
What I mean is an additional property of Exception_frame like .err, .errno or alike, which receives the numeric error code from the driver API in case of an exception.
For example a in my code I'm using:
// If there are many asynchronous inserts, we might hit a deadlock
if (retries < 2 && strncmp(Exception_frame.message, "Deadlock found when trying to get lock; try restarting transaction", 67) == 0) {
retries++;
_usleep(100000);
goto redo;
}
This is kind of ugly...
It would be better to do something like
if (retries < 2 && Exception_frame.errno == ER_LOCK_DEADLOCK) { ... }
Cheers,
Till