(it->value !=
NULL) {
69 if( !
ctx.server_name.empty() ) { server_name =
ctx.server_name; }
70 if( !
ctx.username.empty() ) { username =
ctx.username; }
71 if( !
ctx.database_name.empty() ) { database_name =
ctx.database_name; }
72 if( !
ctx.extra_msg.empty() ) { extra_msg =
ctx.extra_msg; }
78 if( !
ctx.server_name.empty() ) {
79os << delim <<
"SERVER: '"<<
ctx.server_name <<
'\'';
82 if( !
ctx.username.empty() ) {
83os << delim <<
"USER: '"<<
ctx.username <<
'\'';
86 if( !
ctx.database_name.empty() ) {
87os << delim <<
"DATABASE: '"<<
ctx.database_name <<
'\'';
90 if( !
ctx.extra_msg.empty() ) {
91os << delim <<
ctx.extra_msg;
97(
const SContext& new_context)
const 103merged_context->UpdateFrom(new_context);
111 if(
msg.context.NotEmpty()) {
112os <<
' '<< *
msg.context;
122 switch( GetSeverity() ) {
197 unsigned int n= params ? params->
GetNum() : 0;
206my_params.resize(
n);
207 for(
unsigned int i= 0;
i<
n; ++
i) {
208my_params[
i].value =
NULL;
210 for(
unsigned int i= 0;
i<
n; ++
i) {
218}
catch(exception&) {
253 out<<
" [Parameters: ";
256<<
"-row BCP batch whose final row was ";
261 if( !it->name.empty() ) {
262 out<< it->name <<
" = ";
265 out<< it->value->GetLogString();
303 if( !
m_Context->ReferencedOnlyOnce() ) {
306 return const_cast<SContext&
>(*m_Context);
312 switch( x_GetErrCode() ) {
313 case eDS:
return "eDS";
314 case eRPC:
return "eRPC";
315 case eSQL:
return "eSQL";
318 case eClient:
return "eClient";
319 case eMulti:
return "eMulti";
334 interr_code = x_GetErrCode();
340 return static_cast<EType>(err_code);
354 out<<
" Procedure '";
384 out<<
" Procedure '";
413m_Bag = other.
m_Bag;
420 if( ex.GetErrCode() ==
eMulti) {
425 while( (pex = mex.
Pop()) !=
NULL) {
426m_Bag->GetData().push_back( pex );
436m_Bag->GetData().push_back( except_copy );
448 if( m_Bag->GetData().empty() ) {
453m_Bag->GetData().pop_back();
463 str+=
"--- [Multi-Exception";
464 if(!GetModule().
empty()) {
468 str+=
"] Contains a backtrace of ";
470 str+=
" exception";
471 str+= NofExceptions() == 1 ?
"":
"s";
485ReportErrorStack(
out);
489<<
"--- [Multi-Exception] End of backtrace ---";
495 size_trecord_num = m_Bag->GetData().size();
497 if( record_num == 0 ) {
501 if( record_num > m_NofRooms ) {
502 out<<
" *** Too many exceptions -- the last ";
504 out<<
" exceptions are not shown ***";
507TExceptionStack::const_reverse_iterator criter = m_Bag->GetData().rbegin();
508TExceptionStack::const_reverse_iterator eriter = m_Bag->GetData().rend();
510 for(
unsigned int i= 0; criter != eriter &&
i< m_NofRooms; ++criter, ++
i) {
513 out<< (*criter)->what();
531 virtual boolHandleAll(
const TExceptions& exceptions);
533 virtual boolHandleMessage(
intseverity,
intmsgnum,
534 const string& message);
553 throwruntime_error(
"CDB_UserHandler_Wrapper::Reset() -- attempt " 554 "to set handle wrapper as a handler");
586 const string& message)
625 returns_CDB_DefUserHandler.
Get();
653 boolhandled_all =
true;
671 return "Method CDB_UserHandler::GetExtraMsg is deprecated. " 672 "Use CDB_Exception::GetExtraMsg instead.";
738 const string& prefix,
740: m_Output(os ? os : &cerr),
826 if(exceptions.empty())
829TExceptions::const_iterator it = exceptions.end();
831 boolret_val =
false;
832 while(it != exceptions.begin() && !outer_ex) {
855 if(it != exceptions.begin()) {
859outer_ex->AddPrevious(*it);
861 while(it != exceptions.begin());
875: m_UltimateHandlers(ultimate_handlers)
925unique_ptr<CDB_Exception> ex(*it);
927 if(ex->GetSeverity() > max_severity) {
928ex->SetSeverity(max_severity);
934 if(ex2.GetSeverity() > max_severity) {
935ex2.SetSeverity(max_severity);
virtual bool HandleAll(const TExceptions &exceptions)
Handle all of the exceptions resulting from a native API call.
CRef< CDB_UserHandler > m_Handler
virtual bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
CDB_UserHandler_Wrapper(void)
virtual ~CDB_UserHandler_Wrapper()
virtual bool HandleMessage(int severity, int msgnum, const string &message)
Handle message resulting from a native API call.
CDB_UserHandler * Set(CDB_UserHandler *h)
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
T & Get(void)
Create the variable if not created yet, return the reference.
const string & UserName(void) const
const string & GetDatabaseName(void) const
const string & ServerName(void) const
Get the server name, user login name, and password.
void PostMsg(CDB_Exception *ex, const TDbgInfo *dbg_info=NULL, const CConnection *connection=NULL, const CDBParams *params=NULL) const
static CSafeStatic< CDB_Exception::SContext > kEmptyContext
static CDB_UserHandler_Wrapper & GetDefaultCDBErrorHandler(void)
std::ofstream out("events_result.xml")
main entry point for tests
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERASE_ITERATE(Type, Var, Cont)
Non-constant version with ability to erase current element, if container permits.
#define VECTOR_ERASE(Var, Cont)
Use this macro inside body of ERASE_ITERATE cycle to erase from vector-like container.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
static CDB_UserHandler * SetDefault(CDB_UserHandler *h)
CDB_UserHandler_Deferred(const impl::CDBHandlerStack &ultimate_handlers)
virtual bool HandleMessage(int severity, int msgnum, const string &message)
Handle message resulting from a native API call.
EDB_Severity Severity(void) const
virtual ~CDB_UserHandler_Exception(void)
SContext & x_SetContext(void)
virtual ~CDB_UserHandler(void)
virtual void x_Assign(const CException &src) override
void SetUserName(const string &name)
const string & GetDatabaseName(void) const
virtual ~CDB_UserHandler_Stream()
virtual bool HandleAll(const TExceptions &exceptions)
Handle all of the exceptions resulting from a native API call.
virtual const char * GetErrCodeString(void) const override
bool x_HandleAll(const TExceptions &exceptions)
Simply call HandleIt on each exception.
const impl::CDBHandlerStack & m_UltimateHandlers
bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
virtual bool HandleAll(const TExceptions &exceptions)
Handle all of the exceptions resulting from a native API call.
void SetDatabaseName(const string &d)
void SetServerName(const string &sn)
CRef< CObjectFor< TExceptionStack > > m_Bag
virtual void x_Assign(const CException &src) override
void SetParams(const CDBParams *params)
const char * SeverityString(void) const
void ReportErrorStack(ostream &out) const
virtual bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
virtual ~CDB_UserHandler_Exception_ODBC(void)
virtual CDB_Exception * Clone(void) const
virtual ~CDB_UserHandler_Diag()
unsigned int m_NofRooms
Max number of error messages to print..
const string & GetServerName(void) const
int GetDBErrCode(void) const
unsigned int m_RowsInBatch
CDB_UserHandler_Stream(ostream *os=0, const string &prefix=kEmptyStr, bool own_os=false)
virtual void ReportExtra(ostream &out) const override
ostream & operator<<(ostream &os, const CDB_Exception::SContext &ctx)
string WhatThis(void) const
void Flush(EDiagSev max_severity=eDiagSevMax)
virtual void ReportExtra(ostream &out) const override
~CDB_UserHandler_Deferred(void)
static CDB_UserHandler & GetDefault(void)
string GetExtraMsg(void) const
Method is deprecated. Use CDB_Exception::GetExtraMsg() instead.
void SetFromConnection(const impl::CConnection &connection)
TExceptions m_SavedExceptions
void x_StartOfWhat(ostream &out) const
virtual bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
bool HandleAll(const TExceptions &exceptions)
Handle all of the exceptions resulting from a native API call.
static void ClearExceptions(TExceptions &expts)
CDB_Exception * Pop(void)
virtual void x_Assign(const CException &src) override
EErrCode
Error types that can be generated.
CConstRef< SContext > m_Context
CDB_UserHandler_Diag(const string &prefix=kEmptyStr)
const string & GetUserName(void) const
void UpdateFrom(const SContext &ctx)
virtual void ReportExtra(ostream &out) const override
virtual bool HandleAll(const TExceptions &exceptions)
Handle all of the exceptions resulting from a native API call.
void SetExtraMsg(const string &msg) const
Method is deprecated. Use CDB_Exception::SetExtraMsg() instead.
virtual bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
virtual bool HandleIt(CDB_Exception *ex)=0
Handle the exceptions resulting from a native API call, one-by-one.
virtual void x_Assign(const CException &src) override
virtual void ReportExtra(ostream &out) const override
deque< CDB_Exception * > TExceptions
Exception container type.
void x_EndOfWhat(ostream &out) const
void x_Init(const CDiagCompileInfo &info, const string &message, const CException *prev_exception, EDiagSev severity) override
virtual bool HandleAll(const TExceptions &exceptions)
Handle all of the exceptions resulting from a native API call.
bool Push(const CDB_Exception &ex)
virtual bool HandleIt(CDB_Exception *ex)
Handle the exceptions resulting from a native API call, one-by-one.
virtual const string & GetName(const CDBParamVariant ¶m, CDBParamVariant::ENameFormat format=CDBParamVariant::eSQLServerName) const =0
Get name of column.
virtual unsigned int GetNum(void) const =0
Get total number of columns in resultset.
virtual const CDB_Object * GetValue(const CDBParamVariant ¶m) const =0
Get value of column.
virtual CDB_Object * ShallowClone() const
#define NCBI_CURRENT_FUNCTION
Get current function name.
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
#define NCBI_CATCH_ALL_X(err_subcode, message)
void Warning(CExceptionArgs_Base &args)
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.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
void Info(CExceptionArgs_Base &args)
void AtomicResetFrom(const TThisType &ref)
Reset reference object to new pointer.
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const char * Endl(void)
Platform-specific EndOfLine.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
const char *const kEmptyCStr
Empty "C" string (points to a '\0').
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
Definition of all error codes used in dbapi libraries (dbapi_driver.lib and others).
constexpr bool empty(list< Ts... >) noexcept
Static variables safety - create on demand, destroy on application termination.
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