LibreOffice Module connectivity (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
dbtools::SQLExceptionInfo Class Referencefinal

#include <dbexception.hxx>

Public Types

enum class  TYPE {
  SQLException ,
  SQLWarning ,
  SQLContext ,
  Undefined
}
 

Public Member Functions

 SQLExceptionInfo ()
 
 SQLExceptionInfo (const css::sdbc::SQLException &_rError)
 
 SQLExceptionInfo (const css::sdbc::SQLWarning &_rError)
 
 SQLExceptionInfo (const css::sdb::SQLContext &_rError)
 
 SQLExceptionInfo (const OUString &_rSimpleErrorMessage)
 convenience constructor More...
 
 SQLExceptionInfo (const css::uno::Any &_rError)
 
void prepend (const OUString &_rErrorMessage)
 prepends a plain error message to the chain of exceptions More...
 
void append (TYPE _eType, const OUString &_rErrorMessage, const OUString &_rSQLState=OUString(), const sal_Int32 _nErrorCode=0)
 appends a plain message to the chain of exceptions More...
 
void doThrow ()
 throws (properly typed) the exception contained in the object @precond isValid() returns <TRUE> More...
 
SQLExceptionInfooperator= (const css::sdbc::SQLException &_rError)
 
SQLExceptionInfooperator= (const css::sdbc::SQLWarning &_rError)
 
SQLExceptionInfooperator= (const css::sdb::SQLContext &_rError)
 
SQLExceptionInfooperator= (const css::sdb::SQLErrorEvent &_rErrorEvent)
 
SQLExceptionInfooperator= (const css::uno::Any &_rCaughtSQLException)
 
bool isKindOf (TYPE _eType) const
 
bool isValid () const
 
TYPE getType () const
 
 operator const css::sdbc::SQLException * () const
 
 operator const css::sdb::SQLContext * () const
 
const css::uno::Any & get () const
 
void clear ()
 

Static Public Member Functions

static css::uno::Any createException (TYPE eType, const OUString &rErrorMessage, const OUString &rSQLState, const sal_Int32 nErrorCode)
 
static css::sdbc::SQLException * getLastException (css::sdbc::SQLException *pLastException)
 

Private Member Functions

void implDetermineType ()
 

Private Attributes

css::uno::Any m_aContent
 
TYPE m_eType
 

Detailed Description

Definition at line 56 of file dbexception.hxx.

Member Enumeration Documentation

◆ TYPE

Enumerator
SQLException 
SQLWarning 
SQLContext 
Undefined 

Definition at line 59 of file dbexception.hxx.

Constructor & Destructor Documentation

◆ SQLExceptionInfo() [1/6]

dbtools::SQLExceptionInfo::SQLExceptionInfo ( )

Definition at line 40 of file dbexception.cxx.

References m_eType, and Undefined.

◆ SQLExceptionInfo() [2/6]

dbtools::SQLExceptionInfo::SQLExceptionInfo ( const css::sdbc::SQLException &  _rError)

Definition at line 46 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ SQLExceptionInfo() [3/6]

dbtools::SQLExceptionInfo::SQLExceptionInfo ( const css::sdbc::SQLWarning &  _rError)

Definition at line 53 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ SQLExceptionInfo() [4/6]

dbtools::SQLExceptionInfo::SQLExceptionInfo ( const css::sdb::SQLContext &  _rError)

Definition at line 60 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ SQLExceptionInfo() [5/6]

dbtools::SQLExceptionInfo::SQLExceptionInfo ( const OUString &  _rSimpleErrorMessage)

convenience constructor

If your error processing relies on SQLExceptions, and SQLExceptionInfos, you still may need to display an error which consists of a simple message string only. In those cases, you can use this constructor, which behaves as if you would have used an SQLException containing exactly the given error message.

Definition at line 67 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ SQLExceptionInfo() [6/6]

dbtools::SQLExceptionInfo::SQLExceptionInfo ( const css::uno::Any &  _rError)

Member Function Documentation

◆ append()

void dbtools::SQLExceptionInfo::append ( TYPE  _eType,
const OUString &  _rErrorMessage,
const OUString &  _rSQLState = OUString(),
const sal_Int32  _nErrorCode = 0 
)

appends a plain message to the chain of exceptions

Parameters
_eTypethe type of exception to append. Must be SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, for all other values, the behavior is undefined.
_rErrorMessagethe message to append
_rSQLStatethe SQLState of the exception to append
_nErrorCodethe error code of the exception to append

Definition at line 232 of file dbexception.cxx.

References Any, createException(), getLastException(), m_aContent, and m_eType.

◆ clear()

void dbtools::SQLExceptionInfo::clear ( )
inline

Definition at line 128 of file dbexception.hxx.

References m_aContent, and m_eType.

◆ createException()

Any dbtools::SQLExceptionInfo::createException ( TYPE  eType,
const OUString &  rErrorMessage,
const OUString &  rSQLState,
const sal_Int32  nErrorCode 
)
static

Definition at line 191 of file dbexception.cxx.

References Any, eType, SQLContext, SQLException, SQLWarning, and TOOLS_WARN_EXCEPTION.

Referenced by append().

◆ doThrow()

void dbtools::SQLExceptionInfo::doThrow ( )

throws (properly typed) the exception contained in the object @precond isValid() returns <TRUE>

Exceptions
SQLException
RuntimeExceptionif the instance does not contain an SQLException

Definition at line 250 of file dbexception.cxx.

References m_aContent.

◆ get()

const css::uno::Any & dbtools::SQLExceptionInfo::get ( ) const
inline

Definition at line 126 of file dbexception.hxx.

References m_aContent.

Referenced by dbtools::showError().

◆ getLastException()

SQLException * dbtools::SQLExceptionInfo::getLastException ( css::sdbc::SQLException *  pLastException)
static

Definition at line 219 of file dbexception.cxx.

Referenced by append().

◆ getType()

TYPE dbtools::SQLExceptionInfo::getType ( ) const
inline

Definition at line 121 of file dbexception.hxx.

References m_eType.

Referenced by dbtools::SQLExceptionIteratorHelper::SQLExceptionIteratorHelper().

◆ implDetermineType()

void dbtools::SQLExceptionInfo::implDetermineType ( )
private

◆ isKindOf()

bool dbtools::SQLExceptionInfo::isKindOf ( TYPE  _eType) const

Definition at line 147 of file dbexception.cxx.

References m_eType, SQLContext, SQLException, SQLWarning, and Undefined.

◆ isValid()

bool dbtools::SQLExceptionInfo::isValid ( ) const
inline

◆ operator const css::sdb::SQLContext *()

dbtools::SQLExceptionInfo::operator const css::sdb::SQLContext * ( ) const

Definition at line 171 of file dbexception.cxx.

References m_aContent.

◆ operator const css::sdbc::SQLException *()

dbtools::SQLExceptionInfo::operator const css::sdbc::SQLException * ( ) const

Definition at line 164 of file dbexception.cxx.

References m_aContent.

◆ operator=() [1/5]

SQLExceptionInfo & dbtools::SQLExceptionInfo::operator= ( const css::sdb::SQLContext &  _rError)

Definition at line 91 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ operator=() [2/5]

SQLExceptionInfo & dbtools::SQLExceptionInfo::operator= ( const css::sdb::SQLErrorEvent &  _rErrorEvent)

Definition at line 99 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ operator=() [3/5]

SQLExceptionInfo & dbtools::SQLExceptionInfo::operator= ( const css::sdbc::SQLException &  _rError)

Definition at line 75 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ operator=() [4/5]

SQLExceptionInfo & dbtools::SQLExceptionInfo::operator= ( const css::sdbc::SQLWarning &  _rError)

Definition at line 83 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ operator=() [5/5]

SQLExceptionInfo & dbtools::SQLExceptionInfo::operator= ( const css::uno::Any &  _rCaughtSQLException)

Definition at line 107 of file dbexception.cxx.

References implDetermineType(), and m_aContent.

◆ prepend()

void dbtools::SQLExceptionInfo::prepend ( const OUString &  _rErrorMessage)

prepends a plain error message to the chain of exceptions

Parameters
_rSimpleErrorMessagethe error message to prepend

Definition at line 178 of file dbexception.cxx.

References m_aContent, m_eType, and SQLException.

Member Data Documentation

◆ m_aContent

css::uno::Any dbtools::SQLExceptionInfo::m_aContent
private

Definition at line 62 of file dbexception.hxx.

Referenced by append(), doThrow(), implDetermineType(), operator=(), prepend(), and SQLExceptionInfo().

◆ m_eType

TYPE dbtools::SQLExceptionInfo::m_eType
private

Definition at line 63 of file dbexception.hxx.

Referenced by append(), implDetermineType(), isKindOf(), and prepend().


The documentation for this class was generated from the following files: