Error Handling

Errors, warnings, return codes, and related helper functions. More...

Data Structures

struct  ErrorInfo
 Error information. More...

Defines

#define _DB_ERROR(n)   ((_dbstatus_t) -n)
#define _DB_WARNING(n)   ((_dbstatus_t) (1 + n))
#define DB_OK   ((db_result_t)1)
#define DB_FAIL   ((db_result_t)0)
#define DB_WTIME_FAIL   ((db_wtime_t)(-1))
#define DB_LEN_FAIL   ((db_len_t)(-1))

Typedefs

typedef int _dbstatus_t
typedef struct rc_s * db_result_t

Error support routines



int set_db_error (_dbstatus_t rc_t)
_dbstatus_t get_db_error ()
_dbstatus_t clear_db_error ()
void save_db_error (ErrorInfo *)
void restore_db_error (const ErrorInfo *)
#define DB_PUSH_ERROR(__error_info__)   save_db_error(__error_info__)
#define DB_POP_ERROR(__error_info__)   restore_db_error(__error_info__)
#define DB_SET_ERROR(x)   set_db_error(x)
#define DB_RAISE_ERROR(x)   return DB_SET_ERROR(x)
#define DB_THROW_ERROR(x)   do { int __rc__ = (x); if (DB_FAILED(__rc__)) DB_RAISE_ERROR(__rc__); } while(0)
#define DB_ONERROR_GOTO(x, lab)   do { int __rc__ = (x); if (DB_FAILED(__rc__)) goto lab; } while(0)
#define DB_ONERROR_RET(x, result)   do { int __rc__ = (x); if (DB_FAILED(__rc__)) return result; } while(0)

Error Codes



#define DB_NOERROR   0
#define DB_FAILURE   -1

OS Errors



#define DB_EBADF   -2
#define DB_EEXIST   -3
#define DB_ENOENT   -4
#define DB_ENOSPACE   -5
#define DB_EIO   -6
#define DB_EACCESS   -7
#define DB_EEXTEND   -8
#define DB_EDEADLOCK   -9
#define DB_ELOCKED   -10

Argument Errors



#define DB_EINVAL   -11
#define DB_ERANGE   -12
#define DB_ESTATE   -13
#define DB_ENOTIMPL   -14
#define DB_ENOMEM   -15
#define DB_EOSERROR   -16
#define DB_ENOTAPPLICABLE   -17
#define DB_ENOTHREAD   -18
#define DB_EINTERNAL   -19
#define DB_EINVPATH   -20
#define DB_EINVFS   -21
#define DB_EDBGFAILURE   -22
#define DB_ENLSSPACE   -23
#define DB_EINVCHAR   -24
#define DB_EINVENC   -25

Socket Errors



#define DB_ESOCKETSTARTUP   -50
#define DB_ESOCKETOPEN   -51
#define DB_ESOCKET   -52
#define DB_ESOCKETHOSTNAME   -53
#define DB_ESOCKETCONNECTION   -54
#define DB_ESOCKETRECV   -55
#define DB_ESOCKETSEND   -56
#define DB_ESOCKETNOTCONN   -57

Error test routines



#define DB_SUCCESS(x)   ((int32_t)(x) >= DB_NOERROR)
#define DB_FAILED(x)   ((int32_t)(x) < DB_NOERROR)

General Errors



#define DB_INCOMPLETE   +113
#define DB_EDUPLICATE   -100
#define DB_ENOTFOUND   -101
#define DB_ENOMOREDATA   -102
#define DB_EKEYOUTOFRANGE   -103
#define DB_EEMPTYRANGE   -104
#define DB_EBTREESLOTTOOLARGE   -105
#define DB_ENEEDREVALIDATE   -106
#define DB_ENORECORD   -107
#define DB_ENAME   -109
#define DB_EROWRANGE   -110
#define DB_ESHUTDOWN   -111
#define DB_ECONNLOCK   -112

Table Errors



#define DB_ETABLE   -120
#define DB_ETABLETYPE   -121
#define DB_ENOTABLE   -122
#define DB_ENOMEMSTORAGE   -123
#define DB_ENOCONSTRAINT   -125
#define DB_ETABLEEXISTS   -126

Index Errors



#define DB_EINDEX   -130
#define DB_EPRIMARYDUP   -131
#define DB_EFKREFERENCE   -132
#define DB_EFKRESTRICTED   -133
#define DB_EFKMATCHFULL   -134
#define DB_EFKEYDEF   -135
#define DB_EFKLIMIT   -136

Field Errors



#define DB_EFIELD   -140
#define DB_EDUPLICATEFIELDS   -141
#define DB_EFIELDSIZE   -142
#define DB_EBINDSIZE   -143
#define DB_EPARAM   -144
#define DB_EINDVALUE   -145
#define DB_ENULLFIELD   -146
#define DB_EFIELDTYPE   -147

Sequence Errors



#define DB_ESEQ   -150
#define DB_ESEQ_OVERFLOW   -151
#define DB_ESEQ_NOCURVAL   -152

Row Errors



#define DB_EINVALROWTYPE   -160
#define DB_EINVALKEYTYPE   -161
#define DB_EKEYTOOSHORT   -162
#define DB_ERECORDSIZE   -163

Data Errors



#define DB_ECURSOR   -169
#define DB_EDATA   -170
#define DB_ECONVERT   -171
#define DB_EINVTYPE   -173

Kernel Errors



#define DB_ENOBUFFER   -172
#define DB_ESTORAGE   -174
#define DB_ECRC   -175
#define DB_ERECOVERY   -176
#define DB_EUNDOSPACE   -177
#define DB_EJOURNALTYPE   -178
#define DB_EJOURNAL   -179
#define DB_EJOURNALCRC   -180
#define DB_EPREPARED   -181

Transaction Errors



#define DB_ENOTX   -190
#define DB_ETXSTATE   -191
#define DB_ETXACTIVE   -192
#define DB_ESAVEPOINTEXIST   -193
#define DB_ENOSAVEPOINT   -194
#define DB_ETXKIND   -195
#define DB_EDTMXID   -196

Shared Access Errors



#define DB_ENOLOCK   -200
#define DB_EMAXLOCKERS   -201
#define DB_EINVLOCK   -202
#define DB_EWAITINTR   -203
#define DB_ENOLOCKOBJ   -204

Other Errors



#define DB_EUSER   -210
#define DB_EAPIVER   -220
#define DB_EEVALUATION   -250

IPC Client/Server Errors



#define DB_EIPCPROTO   -300
#define DB_EIPCINVAL   -301
#define DB_EIPCINVALMESSAGETAG   -302
#define DB_EIPCINVALPROCTAG   -303
#define DB_EIPCSTORAGEALREADYOPENED   -304
#define DB_EIPCSTORAGENOTOPENED   -305
#define DB_EIPCINVALHANDLE   -306
#define DB_EIPCNULLPARAM   -307
#define DB_EIPCTOOFEWPARAMS   -308
#define DB_EIPCINVALMESSAGESIZE   -309
#define DB_EIPCINVALMESSAGEFORMAT   -310
#define DB_EIPCINVALURL   -311
#define DB_EIPCINVALURLSCHEMA   -312
#define DB_EIPCENVSTARTUP   -313
#define DB_EIPCACCESS   -314
#define DB_EIPCMAXCONNECTIONS   -315
#define DB_EIPCALREADYSTARTED   -316
#define DB_EIPCNOLISTENER   -317
#define DB_EIPCDISCONNECT   -318

SQL Statement Errors



#define DB_ESQLCODESIZETOOLARGE   -400
#define DB_ESQLTABLENOTEXISTS   -401
#define DB_ESQLINVALIDCOLUMNNAME   -402
#define DB_ESQLCOLUMNAMBIGUOUSLYDEFINED   -403
#define DB_ESQLINCOMPATIBLETYPES   -404
#define DB_ESQLINVALIDFUNCTIONNAME   -405
#define DB_ESQLINVALIDNUMBEROFARGUMENTS   -406
#define DB_ESQLININVALIDARGUMENTTYPE   -407
#define DB_ESQLINVALIDNUMBER   -408
#define DB_ESQLINVALIDQUALIFIER   -409
#define DB_ESQLINCOMPATIBLEROWTYPES   -410
#define DB_ESQLPARSEERROR   -411
#define DB_ESQLNOTAGROUPBYEXPRESSION   -412
#define DB_ESQLFEATURENOTALLOWED   -413
#define DB_ESQLDIVIDEBYZERO   -414
#define DB_ESQLTYPECVTNOTIMPLEMENTED   -415
#define DB_ESQLOPERATIONNOTIMPLEMENTED   -416
#define DB_ESQLINVALIDRELATIONALOPERATOR   -417
#define DB_ESQLROWSIZETOOLARGE   -418
#define DB_ESQLNOTSORTABLETYPE   -419
#define DB_ESQLNOENOUGHVALUES   -420
#define DB_ESQLTOOMANYVALUES   -421
#define DB_ESQLBOOLEXPRESSIONINSELECTLIST   -422
#define DB_ESQLENV   -423
#define DB_ESQLINCONSISTENTPARAMTYPE   -424
#define DB_ESQLCOULDNOTDEDUCEPARAMTYPE   -425
#define DB_ESQLINVALIDPARAMINDEX   -426
#define DB_ESQLPARAMCONVERT   -427
#define DB_ESQLMIXEDPARAMSTYLE   -428
#define DB_ESQLINVALIDCOLUMNINDEX   -429
#define DB_ESQLINVALIDSORTCOLUMN   -430
#define DB_ESQLINVALIDEXPRTYPE   -431
#define DB_ESQLBINARYLITERAL   -432

Replication Errors



#define DB_EREP_PEERPATH   -500
#define DB_EREP_PEERADDRESS   -501
#define DB_EREP_ADDRESS   -502
#define DB_EREP_INVADDRESS   -503
#define DB_EREP_LOOPBACK   -504
#define DB_EREP_NOPEER   -505
#define DB_EREP_CONFLICT   -506
#define DB_EREP_NOCONN   -507
#define DB_EREP_BUFSIZE   -508

Detailed Description

Errors, warnings, return codes, and related helper functions.

Many errors can occur during a C API function call. When an error occurs, an error code is set that indicates the kind of error encountered. To retrieve the most recent error code, call get_db_error. You can check the error code with DB_SUCCESS or DB_FAILED to determine whether the call was successful. Some error codes are only warnings, and are considered success. Warnings are represented by positive values, while errors are indicated by negative values.

You can also check whether a C API function call was successful by inspecting the return value. Many API functions return a value of type db_result_t. In this case, the value is either DB_OK if the call was successful, or DB_FAIL if not. Any function that returns a handle type (e.g. db_t) will return NULL in case of failure.

The following list indicates what value will be returned when a function with the given return type encounters an error:

 All Data Structures Files Functions Variables Typedefs Defines
Copyright © 2005-2011 ITTIA®. All rights reserved.