CDBHandlerStack;
61 #define NCBI_DATABASE_EXCEPTION_DEFAULT_IMPLEMENTATION(exception_class, base_class, db_err_code) \ 63 this->x_InitCDB(db_err_code); \ 65 exception_class(const exception_class& other) \ 71 virtual ~exception_class(void) noexcept {} \ 72 const char* GetType(void) const override {return #exception_class;} \ 73 typedef int TErrCode; \ 74 TErrCode GetErrCode(void) const \ 76 return typeid(*this) == typeid(exception_class) ? \ 77 (TErrCode)x_GetErrCode() : (TErrCode)CException::eInvalid; \ 79 virtual CDB_Exception* Clone(void) const override \ 81 return new exception_class(*this); \ 83 NCBI_EXCEPTION_DEFAULT_THROW(exception_class) \ 85 exception_class(void) {} \ 86 virtual const CException* x_Clone(void) const override \ 88 return new exception_class(*this); \ 92 static void xx_unused_##exception_class(void) 177 operator const string&(void)
const{
returnmessage; }
186 const char* SeverityString(
void)
const;
195EType
Type(
void)
const;
202 void SetServerName(
const string& sn) { x_SetContext().server_name = sn; }
205 void SetUserName(
const string& name) { x_SetContext().username = name; }
214{ x_SetContext().UpdateFrom(
ctx); }
243 constSMessageInContext& message,
251, m_DBErrCode(db_err_code)
253, m_SybaseSeverity(0)
264 Eex(
info,
nullptr, message, severity, db_err_code);
276 voidx_StartOfWhat(ostream&
out)
const;
277 voidx_EndOfWhat (ostream&
out)
const;
281 void x_InitCDB(
intdb_error_code) { m_DBErrCode = db_error_code; }
338 const string& proc_name,
346, m_ProcName(proc_name.
empty() ?
"Unknown": proc_name)
347, m_ProcLine(proc_line)
353 const string&
ProcName()
const{
returnm_ProcName; }
376 const string& sql_state,
384, m_SqlState(sql_state.
empty() ?
"Unknown": sql_state)
385, m_BatchLine(batch_line)
391 const string&
SqlState()
const{
returnm_SqlState; }
458message + dbg_info, severity, db_err_code)
460SetFromConnection(connection);
509 unsigned intcapacity = 64)
517, m_NofRooms( capacity )
528 return static_cast<unsigned int>( m_Bag->GetData().size() );
530 unsigned int Capacity()
const{
returnm_NofRooms; }
532 stringWhatThis(
void)
const;
537 voidReportErrorStack(ostream&
out)
const;
584 virtual boolHandleAll(
const TExceptions& exceptions);
598 virtual boolHandleMessage(
intseverity,
intmsgnum,
const string& message);
636 virtual boolHandleAll(
const TExceptions& exceptions);
649 boolown_os =
false);
656 virtual boolHandleAll(
const TExceptions& exceptions);
675 virtual boolHandleAll(
const TExceptions& exceptions);
715 #define NCBI_DATABASE_THROW( exception_class, message, err_code, severity ) \ 717 NCBI_NS_NCBI::CDB_Exception::MakeException<exception_class>( \ 718 DIAG_COMPILE_INFO, (message), severity, err_code); \ 720 #define NCBI_DATABASE_RETHROW( prev_exception, exception_class, message, \ 721 err_code, severity ) \ 722 throw exception_class( DIAG_COMPILE_INFO, \ 723 &(prev_exception), (message), severity, err_code ) 726 #define NCBI_DATABASE_THROW_ANNOTATED(ex_class, message, err_code, severity, \ 727 dbg_info, conn, params) \ 729 ex_class ex(DIAG_COMPILE_INFO, NULL, (message), severity, err_code, \ 730 dbg_info, conn, params); \ 731 ex.SetRetriable(eRetriable_No); \ 735 #define NCBI_DATABASE_RETHROW_ANNOTATED(prev_ex, ex_class, message, err_code, \ 736 severity, dbg_info, conn, params) \ 737 throw ex_class(DIAG_COMPILE_INFO, &(prev_ex), (message), severity, \ 738 err_code, dbg_info, conn, params) 740 #define DATABASE_DRIVER_ERROR( message, err_code ) \ 741 NCBI_DATABASE_THROW( CDB_ClientEx, message, err_code, eDiag_Error ) 742 #define DATABASE_DRIVER_ERROR_EX( prev_exception, message, err_code ) \ 743 NCBI_DATABASE_RETHROW( prev_exception, CDB_ClientEx, message, err_code, \ 746 #define DATABASE_DRIVER_WARNING( message, err_code ) \ 747 NCBI_DATABASE_THROW( CDB_ClientEx, message, err_code, eDiag_Warning ) 748 #define DATABASE_DRIVER_WARNING_EX( prev_exception, message, err_code ) \ 749 NCBI_DATABASE_RETHROW( prev_exception, CDB_ClientEx, message, err_code, \ 752 #define DATABASE_DRIVER_FATAL( message, err_code ) \ 753 NCBI_DATABASE_THROW( CDB_ClientEx, message, err_code, eDiag_Fatal ) 754 #define DATABASE_DRIVER_FATAL_EX( prev_exception, message, err_code ) \ 755 NCBI_DATABASE_RETHROW( prev_exception, CDB_ClientEx, message, err_code, \ 758 #define DATABASE_DRIVER_INFO( message, err_code ) \ 759 NCBI_DATABASE_THROW( CDB_ClientEx, message, err_code, eDiag_Info ) 760 #define DATABASE_DRIVER_INFO_EX( prev_exception, message, err_code ) \ 761 NCBI_DATABASE_RETHROW( prev_exception, CDB_ClientEx, message, err_code, \ 765 #define CHECK_DRIVER_ERROR( failed, message, err_code ) \ 766 if ( ( failed ) ) { DATABASE_DRIVER_ERROR( message, err_code ); } 768 #define CHECK_DRIVER_WARNING( failed, message, err_code ) \ 769 if ( ( failed ) ) { DATABASE_DRIVER_WARNING( message, err_code ); } 771 #define CHECK_DRIVER_FATAL( failed, message, err_code ) \ 772 if ( ( failed ) ) { DATABASE_DRIVER_FATAL( message, err_code ); } 774 #define CHECK_DRIVER_INFO( failed, message, err_code ) \ 775 if ( ( failed ) ) { DATABASE_DRIVER_INFO( message, err_code ); }Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
Exception class used throughout the API.
CDB_Exception::TErrCode GetDBErrCode(void) const
Returns any underlying DBAPI error code, or else CException::eInvalid.
CConstRef< CDB_Exception::SContext > m_Context
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
@ eRetriable_Unknown
It is unknown if the action can succeed if retried.
@ eRetriable_No
It makes no sense to retry the action.
void ApplyContext(const SContext &ctx)
void SetSybaseSeverity(int severity)
WARNING !!! Sybase severity value can be provided by Sybase/FreeTDS ctlib drivers only.
CDB_DSEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message, EDiagSev severity, int db_err_code)
const SContext & GetContext(void) const
CDB_RPCEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message, EDiagSev severity, int db_err_code, const string &proc_name, int proc_line)
static void MakeException(const CDiagCompileInfo &info, const SMessageInContext &message, EDiagSev severity, int db_err_code)
const string & OriginatedFrom() const
CConstRef< SContext > context
CDB_ClientEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message, EDiagSev severity, int db_err_code)
void SetUserName(const string &name)
const string & GetDatabaseName(void) const
#define NCBI_DATABASE_EXCEPTION_DEFAULT_IMPLEMENTATION(exception_class, base_class, db_err_code)
Helper macro for default database exception implementation.
virtual const char * TypeString() const
const impl::CDBHandlerStack & m_UltimateHandlers
unsigned int GetRowsInBatch(void) const
void SetDatabaseName(const string &d)
void SetServerName(const string &sn)
void SetExtraMsg(const string &msg)
CRef< CObjectFor< TExceptionStack > > m_Bag
SMessageInContext(const char *msg)
const string & Message(void) const
CDB_UserHandler_Diag CDB_UserHandler_Default
unsigned int NofExceptions() const
unsigned int m_NofRooms
Max number of error messages to print..
const string & GetServerName(void) const
int GetDBErrCode(void) const
unsigned int m_RowsInBatch
const string & SqlState() const
CDB_TruncateEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message, int db_err_code)
ostream & operator<<(ostream &os, const CDB_Exception::SContext &ctx)
unsigned int Capacity() const
CDB_DeadlockEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message)
TExceptions m_SavedExceptions
void SetParams(const CDBParams ¶ms)
CConstRef< SParams > GetParams(void) const
EErrCode
Error types that can be generated.
CConstRef< SContext > m_Context
SMessageInContext(const string &msg, const SContext &ctx)
const string & GetUserName(void) const
CDB_SQLEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message, EDiagSev severity, int db_err_code, const string &sql_state, int batch_line)
deque< AutoPtr< const CDB_Exception > > TExceptionStack
const string & GetExtraMsg(void) const
void x_InitCDB(int db_error_code)
void SetRowsInBatch(unsigned int n)
CDB_Exception::SMessageInContext operator+(const string &msg, const CDB_Exception::SContext &ctx)
virtual bool HandleIt(CDB_Exception *ex)=0
Handle the exceptions resulting from a native API call, one-by-one.
CDB_ClientEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message, EDiagSev severity, int db_err_code, const SContext &dbg_info, const impl::CConnection &connection, const CDBParams *params)
CDB_TimeoutEx(const CDiagCompileInfo &info, const CException *prev_exception, const SMessageInContext &message, int db_err_code)
CDB_MultiEx(const CDiagCompileInfo &info, const CException *prev_exception, unsigned int capacity=64)
deque< CDB_Exception * > TExceptions
Exception container type.
SMessageInContext(const string &msg=kEmptyStr)
const string & ProcName() const
int GetSybaseSeverity(void) const
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiagSevMax
Verbosity level for max. severity.
const string & GetModule(void) const
Get module name used for reporting.
virtual void ReportExtra(ostream &out) const
Report "non-standard" attributes.
virtual const char * GetType(void) const
Get class name as a string.
const string & GetMsg(void) const
Get message string.
virtual void x_Init(const CDiagCompileInfo &info, const string &message, const CException *prev_exception, EDiagSev severity)
Helper method for initializing exception data.
virtual void x_Assign(const CException &src)
Helper method for copying exception data.
#define NCBI_EXCEPTION_DEFAULT_IMPLEMENTATION(exception_class, base_class)
Helper macro for default exception implementation.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
#define EXCEPTION_VIRTUAL_BASE
Do not use virtual base classes in exception declaration at all, because in this case derived class s...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
virtual void SetParams()
Called at the beginning of Run, before creating thread pool.
#define NCBI_DBAPIDRIVER_EXPORT
constexpr bool empty(list< Ts... >) noexcept
Multi-threading â mutexes; rw-locks; semaphore.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Multi-threading â classes, functions, and features.
struct SContext_tag SContext
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static CS_CONTEXT * context
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4