1odbx_error(3)                       OpenDBX                      odbx_error(3)
2
3
4

NAME

6       odbx_error - Returns a human readable error message
7

SYNOPSIS

9       #include <opendbx/api.h>
10
11
12       char* odbx_error (odbx_t* handle, int error);
13

DESCRIPTION

15       odbx_error()  returns an error string corresponding to the supplied er‐
16       ror code or the error string generated by the native database  library.
17       Error  strings originating from the backend modules or the native data‐
18       base client libraries are cleared as soon as the next odbx_*() function
19       is  called.  All error strings are statically allocated and must not be
20       changed or freed. If the OpenDBX library is compiled with  native  lan‐
21       guage support and the user environment variables are set accordingly to
22       a supported language, strings which are part of the OpenDBX library are
23       translated before being returned. This may also be the case for strings
24       returned by the native database libraries but depends on their support.
25
26       The first parameter handle is the connection  object  created  and  re‐
27       turned  by odbx_init() which becomes invalid as soon as it was supplied
28       to odbx_finish(). Anyhow, it isn't necessary to supply a  valid  handle
29       for errors which use error codes not equal to -ODBX_ERR_BACKEND because
30       they are returned directly from a static error  message  array.  There‐
31       fore, it's possible to use odbx_error() even if odbx_init() wasn't suc‐
32       cessful. If -ODBX_ERR_BACKEND is supplied in  this  case  nevertheless,
33       the return error string will be the same as for an invalid handle.
34
35       Almost all OpenDBX library functions return an error code if one of the
36       operations couldn't be completed successfully. The codes  returned  use
37       values  less  than  zero to indicate different kind of errors and these
38       values can be directly passed to odbx_error() to obtain the correspond‐
39       ing zero-terminated error string.
40

RETURN VALUE

42       odbx_error()  returns  a zero-terminated string suitable for being dis‐
43       played to the user of the application.
44

ERRORS

46       If an backend error occurred and handle is NULL or the supplied connec‐
47       tion  object  is invalid, odbx_error() returns the localized string for
48       -ODBX_ERR_PARAM.
49

SEE ALSO

51       odbx_error_type(), odbx_init()
52
53
54
55                                29 January 2020                  odbx_error(3)
Impressum