本文整理汇总了C++中ExceptionRef::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ ExceptionRef::isNull方法的具体用法?C++ ExceptionRef::isNull怎么用?C++ ExceptionRef::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExceptionRef
的用法示例。
在下文中一共展示了ExceptionRef::isNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setException
void Thread::setException(ExceptionRef& e, bool caused)
{
// initialize threads
pthread_once(&sThreadsInit, &initializeThreads);
// get the exception reference for the current thread
ExceptionRef* ref =
static_cast<ExceptionRef*>(pthread_getspecific(sExceptionKey));
if(ref == NULL)
{
// create the exception reference
ref = new ExceptionRef(NULL);
*ref = e;
pthread_setspecific(sExceptionKey, ref);
}
else
{
if(caused && !e.isNull())
{
// set cause of passed exception to previous exception
e->setCause(*ref);
}
// update the reference
*ref = e;
}
}
示例2: rollback
bool AbstractConnection::rollback()
{
bool rval = false;
// save the reason for the rollback
ExceptionRef reason = Exception::get();
// attempt to do the rollback
Statement* s = prepare("ROLLBACK");
rval = (s != NULL) && s->execute() && s->reset();
if(!rval)
{
ExceptionRef e = new Exception(
"Could not rollback transaction.",
"monarch.sql.Connection.TransactionRollbackError");
if(!reason.isNull())
{
e->getDetails()["rollbackReason"] =
Exception::convertToDynamicObject(reason);
}
Exception::push(e);
}
return rval;
}
示例3: hasException
bool Thread::hasException()
{
bool rval = false;
// initialize threads
pthread_once(&sThreadsInit, &initializeThreads);
// get the exception reference for the current thread
ExceptionRef* ref =
static_cast<ExceptionRef*>(pthread_getspecific(sExceptionKey));
if(ref != NULL)
{
// return true if the reference isn't to NULL
rval = !ref->isNull();
}
return rval;
}