Difference between revisions of "OpenDBX/C API/odbx error"
(header) |
(rewrite) |
||
Line 7: | Line 7: | ||
int '''error''' ) | int '''error''' ) | ||
− | = Description | + | = Description = |
− | + | '''odbx_error()''' returns an error string corresponding to the supplied error number or the error string generated by the client libraries. Error strings originating from the backend modules or the native database client libraries are cleared as soon as the next odbx_*() function is called. All error strings are statically allocated and must not be changed or freed. If the OpenDBX library is compiled with native language support and the user environment variables are set accordingly to a supported language, strings which are part of the OpenDBX library are translated before being returned. This may also be the case for strings returned by the native database libraries but depends on their support. | |
− | + | The first parameter '''handle''' have to be the connection object created and returned by [[OpenDBX_init|odbx_init()]] and it becomes invalid as soon as it was supplied to [[OpenDBX_finish|odbx_finish()]]. It isn't necessary to supply a valid handle for errors which use error codes less than -ODBX_ERR_BACKEND because they are returned directly from a static error message array. Therefore, it's possible to use '''odbx_error()''' even if [[OpenDBX_init|odbx_init()]] wasn't successful. | |
− | + | Almost all OpenDBX library functions return an '''error''' code if one of the operations couldn't be completed successfully. The codes returned use values less than zero to indicate different kind of errors and these values can be directly passed to '''odbx_error()''' to obtain the corresponding zero-terminated error string. | |
− | + | ||
− | = Return | + | = Return value = |
− | + | '''odbx_error()''' returns a zero-terminated string suitable for being displayed to the user of the application. | |
− | = Errors | + | = Errors = |
− | + | If an backend error occurred and '''handle''' is NULL or the supplied connection object is invalid, '''odbx_error()''' returns the localized string for -ODBX_ERR_PARAM. | |
− | = See also | + | = See also = |
* [[OpenDBX_error_type]] | * [[OpenDBX_error_type]] |
Revision as of 22:57, 20 February 2007
#include <odbx.h> const char* odbx_error( odbx_t* handle, int error )
Description
odbx_error() returns an error string corresponding to the supplied error number or the error string generated by the client libraries. Error strings originating from the backend modules or the native database client libraries are cleared as soon as the next odbx_*() function is called. All error strings are statically allocated and must not be changed or freed. If the OpenDBX library is compiled with native language support and the user environment variables are set accordingly to a supported language, strings which are part of the OpenDBX library are translated before being returned. This may also be the case for strings returned by the native database libraries but depends on their support.
The first parameter handle have to be the connection object created and returned by odbx_init() and it becomes invalid as soon as it was supplied to odbx_finish(). It isn't necessary to supply a valid handle for errors which use error codes less than -ODBX_ERR_BACKEND because they are returned directly from a static error message array. Therefore, it's possible to use odbx_error() even if odbx_init() wasn't successful.
Almost all OpenDBX library functions return an error code if one of the operations couldn't be completed successfully. The codes returned use values less than zero to indicate different kind of errors and these values can be directly passed to odbx_error() to obtain the corresponding zero-terminated error string.
Return value
odbx_error() returns a zero-terminated string suitable for being displayed to the user of the application.
Errors
If an backend error occurred and handle is NULL or the supplied connection object is invalid, odbx_error() returns the localized string for -ODBX_ERR_PARAM.
See also
Back to Overview