OCILIB (C and C++ Driver for Oracle)  4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
ocilib::Exception Class Reference

Exception class handling all OCILIB errors. More...

#include <types.hpp>

Inherits std::exception.

Public Types

enum  ExceptionTypeValues { OracleError = OCI_ERR_ORACLE , OcilibError = OCI_ERR_OCILIB , OracleWarning = OCI_ERR_WARNING }
 Exception type enumerated values. More...
 
typedef core::Enum< ExceptionTypeValuesExceptionType
 Type of Exception.
 

Public Member Functions

ostring GetMessage () const
 Retrieve the error message.
 
ExceptionType GetType () const
 Return the Exception type.
 
int GetOracleErrorCode () const
 Return the Oracle error code.
 
int GetInternalErrorCode () const
 Return the OCILIB error code.
 
Statement GetStatement () const
 Return the statement within the error occurred.
 
Connection GetConnection () const
 Return the connection within the error occurred.
 
unsigned int GetRow () const
 Return the row index which caused an error during statement execution.
 
const char * what () const noexcept override
 Override the std::exception::what() method.
 
virtual ~Exception () noexcept
 Virtual destructor required for deriving from std::exception.
 

Detailed Description

Exception class handling all OCILIB errors.

This class wraps the OCILIB object handle OCI_Error and its related methods

Definition at line 357 of file types.hpp.

Member Typedef Documentation

◆ ExceptionType

Member Enumeration Documentation

◆ ExceptionTypeValues

Exception type enumerated values.

Enumerator
OracleError 

Exception caused by an Oracle error

OcilibError 

Exception caused by an Ocilib error

OracleWarning 

Exception caused by an Oracle Warning

Definition at line 370 of file types.hpp.

Constructor & Destructor Documentation

◆ ~Exception()

ocilib::Exception::~Exception ( )
inlinevirtualnoexcept

Virtual destructor required for deriving from std::exception.

Definition at line 56 of file Exception.hpp.

Member Function Documentation

◆ GetMessage()

ostring ocilib::Exception::GetMessage ( ) const
inline

Retrieve the error message.

Definition at line 154 of file Exception.hpp.

References what().

◆ GetType()

Exception::ExceptionType ocilib::Exception::GetType ( ) const
inline

Return the Exception type.

Definition at line 200 of file Exception.hpp.

◆ GetOracleErrorCode()

int ocilib::Exception::GetOracleErrorCode ( ) const
inline

Return the Oracle error code.

Definition at line 205 of file Exception.hpp.

◆ GetInternalErrorCode()

int ocilib::Exception::GetInternalErrorCode ( ) const
inline

Return the OCILIB error code.

Definition at line 210 of file Exception.hpp.

◆ GetStatement()

Statement ocilib::Exception::GetStatement ( ) const
inline

Return the statement within the error occurred.

Definition at line 215 of file Exception.hpp.

◆ GetConnection()

Connection ocilib::Exception::GetConnection ( ) const
inline

Return the connection within the error occurred.

Definition at line 220 of file Exception.hpp.

◆ GetRow()

unsigned int ocilib::Exception::GetRow ( ) const
inline

Return the row index which caused an error during statement execution.

Warning
Row index start at 1.
Returns
  • 0 if the error is not related to array DML
  • otherwise the index of the given row which caused the error

Definition at line 225 of file Exception.hpp.

◆ what()

const char * ocilib::Exception::what ( ) const
inlineoverridenoexcept

Override the std::exception::what() method.

Returns
  • The same content as GetMessage() but as using const char * type

Definition at line 149 of file Exception.hpp.

Referenced by GetMessage().