odbx_error_type(3)
π odbx_error_type(3) β OpenDBX manual, bestie edition π
Okay so this is a page from the OpenDBX manual set, and it's about odbx_error_type(3) β literally the vibe check for your error codes β¨
πΈ NAME πΈ
odbx_error_type β returns the severity of an error π
β¨ SYNOPSIS β¨
#include <opendbx/api.h>
int odbx_error_type (odbx_t* handle, int error);
π¦ DESCRIPTION π¦
So odbx_error_type() is literally giving you the tea on how serious the error code is β the one that the last function call handed back to you through the error parameter. It's how you tell the difference between a critical error and a little warning, so your app can react the right way instead of just panicking π
The way it works: if it's a warning, your application can usually keep going β just tell the user what happened and deal with it up on the application-logic level, no drama. But if it's a severe error, bestie, you always have to recreate the connection. No exceptions. π
And heads up β in both cases, all the errors that got returned get overwritten the moment the next odbx_*() function is called. So don't get attached to them π«Ά
Also, this function has been available since release 1.1.2, iykyk.
Let's takeodbx_query()(or literally any other function) as the example, and say it returned an error. If the return value ofodbx_error_type()is negative, you've hit a severe error β like the connection to the server is broken π. In that case you have to callodbx_unbind(),odbx_finish(),odbx_init()andodbx_bind()in this order to recreate the connection. Otherwise, if the return value was positive, your statement might just have been not understood by the database server. And that's lowkey fine β here you can keep sending the next statement to the server with no need to recreate the connection at all π
Now about the handle parameter: it's the connection object that odbx_init() created and returned if the call was successful, and it becomes invalid as soon as you've supplied it to odbx_finish(). Iconic, honestly.
But anyhow β it isn't necessary to supply a valid handle for errors that use error codes not equal to -ODBX_ERR_BACKEND. Which means it's totally possible to use odbx_error_type() even if odbx_init() returned an error π. Though if -ODBX_ERR_BACKEND is supplied in that case nevertheless, the return value will indicate a critical error. Periodt.
Also, all values returned by odbx_*() functions can be fed directly via the error parameter into this function. If the given value doesn't indicate an error, the returned code will always be zero for successful completion. Negative values get separated into classes for critical errors and warnings instead β¨
π RETURN VALUE π
On success β i.e. if ODBX_ERR_SUCCESS or a positive value is supplied as the value of error β the function returns zero. Otherwise, there will be positive and negative values returned, depending on the severity of the error that occurred. Let's break it down:
- Positive values (values greater than zero) β these indicate recoverable errors that leave the database connection intact π«Ά. An example might be a warning if a record couldn't be inserted into the table for any reason. In this case, further statements can be sent to the database server and they are likely to succeed. Slay.
- Negative values (values less than zero) β if one of these comes back, a severe error has happened in the backend module, the native database client library or the database server π. The connection to the server might be lost, or an out of memory condition might have occurred. This means all further calls to the OpenDBX library will probably fail, and the only way to recover from this situation is to clean up the connection by using
odbx_unbind()andodbx_finish()and trying to create a new connection from the ground up. Full reset, main character energy only π
π ERRORS π
This function doesn't return any errors. Not a single one. Fr fr π
π₯ SEE ALSO π₯
odbx_finish()odbx_init()odbx_unbind()
βΏ and that's the whole page, bestie βΏ
This little gem comes from OpenDBX, dated 6 February 2026 β go forth and check those error types, you've got this ππ¦πΈ
π¦ where this page comes from
- ubuntu resolute: libopendbx1-dev 1.4.6-18build2
- ubuntu stonking: libopendbx1-dev 1.4.6-18build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms