solidDB Help : Programming : solidDB SA : Handling database errors
  
Handling database errors
solidDB SA does not provide ODBC-like error processing capability. Generally, solidDB SA functions return SA_RC_SUCC or a pointer to the requested object if successful. If not successful, then the return value is either one of the solidDB SA error codes (see the following table) or NULL. If the error is a database error, the error text is returned by the SaErrorInfo function.
if (scon == NULL) {
  /* Connect failed, display connect error text. */
  char* errstr;
  SaErrorInfo(NULL, &errstr, NULL);
  printf("%s\n", errstr);
  return(1);
}
The function SaCursorErrorInfo returns error text if the last cursor operation failed. Note that SaErrorInfo has a connection parameter and thus returns the last error applicable to that connection, while SaCursorErrorInfo has a cursor parameter and thus returns the last error of that cursor.
The following table lists the possible return codes for solidDB SA functions. All of these error codes are defined in the sa.h file.
 
Error code
Meaning
SA_RC_SUCC
Operation was successful
SA_RC_END
Operation has completed
SA_ERR_FAILED
Operation failed
SA_ERR_CURNOTOPENED
Cursor is not open
SA_ERR_CUROPENED
Cursor is open
SA_ERR_CURNOSEARCH
No active search in cursor
SA_ERR_CURSEARCH
There is active search in cursor
SA_ERR_ORDERBYILL
Illegal "order by" specification
SA_ERR_COLNAMEILL
Illegal column name
SA_ERR_CONSTRILL
Illegal constraint
SA_ERR_TYPECONVILL
Illegal type conversion
SA_ERR_UNIQUE
Unique constraint violation
SA_ERR_LOSTUPDATE
Concurrency conflict, two transactions updated or deleted the same row
SA_ERR_SORTFAILED
Failed to sort the search result set
SA_ERR_CHSETUNSUPP
Unsupported character set
SA_ERR_CURNOROW
No current row in cursor
SA_ERR_COLISNOTNULL
NULL value given for a NOT NULL column
SA_ERR_LOCALSORT
Result set is sorted locally, cannot update or delete the row
SA_ERR_COMERROR
Communication error, connection is lost
SA_ERR_NOSTRCONSTR
String for constraint is missing.
SA_ERR_ILLENUMVAL
Illegal numeric value
SA_ERR_COLNOTBOUND
Column is not bound
SA_ERR_CALLNOSUP
Operation is not supported*
SA_ERR_RPCPARAM
RPC parameter error
SA_ERR_TABLENOTFOUND
Table not found
SA_ERR_READONLY
Connection is read-only
SA_ERR_ILLPARAMCOUNT
Wrong number of parameters
SA_ERR_INVARG
Invalid argument
SA_ERR_INVCALLSEQ
Invalid call sequence
SaArray* functions are not supported in linked library access; they work only with the network client library. They return SA_ERR_CALLNOSUP with linked library access.
Go up to
solidDB SA