|Oracle Objects for OLE C++ Class Library
Part Number A95896-01
The simplest kind of error handling is to know whether a method succeeded in its operation or not. This level of error handling is accomplished by looking at the return value of the method. Most methods in the library return a result of type oresult. An oresult will either have the value OSUCCESS, which indicates that the method worked, or OFAILURE, which indicates that some error occurred during the method's execution.
Note: Beginning with this release, newly introduced methods may throw an OException object in the case of an error.
After an error has occurred, you will often want more information about exactly what went wrong. There are two broad categories of problems:
· Errors that occur in the server. These are things like invalid SQL statements, attempting to access records that are locked, etc.
· Errors occurring in the class library. These are things like improperly initialized objects, invalid arguments, out of memory conditions and so on.
The two categories of problems are reported in different ways.
The Oracle errors are reported via the ServerErrorNumber and GetServerErrorText methods of OSession and ODatabase. Errors that occur when connecting to the database, or in the execution of transaction operations, will be reported via OSession. Errors that occur while processing an SQL statement, for instance when opening a dynaset or using ExecuteSQL, will be reported via ODatabase. The number returned by ServerErrorNumber is a standard Oracle error number. An error number of 0 indicates no error. The text returned by GetServerErrorText is the standard Oracle error message. For more information about Oracle errors consult your Oracle documentation.
The class library errors are reported via the ErrorNumber and GetErrorText methods that are supported by most of the objects (all those that inherit these methods from OOracleObject). Each object will have available the most recent state of that object. The object's error state is cleared at the beginning of executing each method. GetErrorText will not have explanatory text available for all errors.
Because error reporting is done via additional calls rather than through returns of error codes it is possible to obtain error information about the execution of methods that cannot have error return values such as constructors and overloaded assignment operators. After using a constructor, especially a "construct and open" constructor or an assignment operator you should check an object's error state by calling ErrorNumber.
The following table lists all possible error codes returned by ErrorNumber and a brief explanation of each:
Error Codes Returned by ErrorNumber
||Couldn't allocate necessary memory.
||An attempt was made to get an object from an unopened object.
||An attempt was made to use an unopened object
||One of the arguments to the method is invalid.
||The current record is not valid.
||Internal error: Invalid advisory connection.
||An attempt was made to retrieve a field value from an empty dynaset.
||An invalid field name was specified.
||A BeginTransaction was specified while a transaction is already in progress
||A CommitTransaction was specified without first executing BeginTrans.
||A Rollback was specified without first executing BeginTrans.
||Internal error: System attempted to destroy non-existent dynaset.
||An attempt was made to reference an invalid row. This will happen when IsEOF or IsBOF is True or when the current row has been deleted and no record movement has occurred.
||An error occurred while trying to create a temporary file for data caching.
||An attempt was made to create a named session that already exists.
||Internal error: System attempted to destroy non-existent session.
||An attempt was made to reference a named object of a collection (other than the fields collection) that does not exist.
||Internal error: Duplicate connection name.
||Internal error: System attempted to destroy non-existent connection.
||An invalid field index was specified. The range of indices is 0 to Count -1.
||Internal error: System attempted to move to row in invalid dynaset.
||An attempt was made to change the data of a non-updatable dynaset.
||An attempt was made to change a fields value without first executing StartEdit.
||An attempt was made to Edit data in the local cache, but the data on the Oracle server has been changed.
||Out of memory for data binding buffers.
||An invalid bookmark was specified.
||Internal error: Bind variable not enabled.
||An attempt was made to create a named parameter using Add, but that name already exists.
||An invalid offset or length parameters was passed to GetChunk or an internal error has occurred using AppendChunk.
||An attempt was made to use GetChunk or Append Chunk on a field that was not of the type Long or Long Raw.
||A SELECT ... FOR UPDATE was specified without first executing BeginTransaction
||A SELECT ... FOR UPDATE was specified but the query is non-updatable.
||A Commit or Rollback was executed while a SELECT ... FOR UPDATE is in progress.
||An invalid cache parameter was specified.
||An attempt was made to reference a field that requires a ROWID (Long or Long Raw), but the ROWID was not available.
||Element size specified in AddTable exceeds the maximum allowed size for that variable type. See AddTable Method for more details.
||Dimension specified in AddTable is invalid (negative). See AddTable Method for more details.
||Buffer size for parameter array variable exceeds 32512 bytes (OCI limit).
||Dimensions of array parameters used in insert/update/delete statements are not equal.
||Error processing arrays. For details refer to OO4OERR.LOG in the windows directory.
||Non-blocking operation in progress
||Operation is valid only when non-block is in progress
Find Method Parser Errors
Find method parser errors occur when the parser cannot parse the expression (find clause) in a Find method. These errors specify what part of the expression caused the error.
Find Method Parser Errors
||Misplaced quotation marks
||WARNING: Missing closing parenthesis
||Usually open parentheses expected
||Unknown parser error condition
||Syntax not supported
||Invalid column name
||Maximum token size exceed in token.
||Unsupported data type
||Unexpected token found.
Find method runtime errors occur when the system cannot evaluate a find expression. Such errors are rare. When one occurs, the parser might have generated incorrect code.
Find Method Runtime Errors
||Internal error: Invalid instruction
||Internal error: Stack over/under-flow
||Invalid type conversion
||SQL function missing argument
||Select from dual failed
||Invalid datatype in Select from dual