本文整理汇总了C++中Query::failed方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::failed方法的具体用法?C++ Query::failed怎么用?C++ Query::failed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::failed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void MailboxReader::execute() {
while ( q->hasResults() ) {
Row * r = q->nextRow();
UString n = r->getUString( "name" );
uint id = r->getInt( "id" );
Mailbox * m = ::mailboxes->find( id );
if ( !m || m->name() != n ) {
m = Mailbox::obtain( n );
if ( n != m->d->name )
m->d->name = n;
m->setId( id );
::mailboxes->insert( id, m );
}
if ( r->getBoolean( "deleted" ) )
m->setType( Mailbox::Deleted );
else
m->setType( Mailbox::Ordinary );
uint uidvalidity = r->getInt( "uidvalidity" );
if ( m->d->uidvalidity != uidvalidity ) {
m->d->uidvalidity = uidvalidity;
m->abortSessions();
}
if ( !r->isNull( "owner" ) )
m->setOwner( r->getInt( "owner" ) );
m->setUidnextAndNextModSeq( r->getInt( "uidnext" ),
r->getBigint( "nextmodseq" ),
q->transaction() );
m->setFlag( r->getEString( "flag" ) );
}
if ( !q->done() || done )
return;
done = true;
if ( q->transaction() )
q->transaction()->commit();
::readers->remove( this );
::wiped = false;
if ( q->failed() && !EventLoop::global()->inShutdown() ) {
List<Mailbox> * c = Mailbox::root()->children();
if ( c && !c->isEmpty() )
log( "Couldn't update mailbox tree: " + q->error() );
else
log( "Couldn't create mailbox tree: " + q->error(),
Log::Disaster );
}
if ( owner )
owner->execute();
};
示例2: execute
void execute()
{
if ( !q ) {
q = new Query( "select not exists (select * from "
"information_schema.table_privileges where "
"privilege_type='DELETE' and table_name="
"'messages' and grantee=$1) and not exists "
"(select u.usename from pg_catalog.pg_class c "
"left join pg_catalog.pg_user u on "
"(u.usesysid=c.relowner) where c.relname="
"'messages' and u.usename=$1) as allowed",
this );
q->bind( 1, Configuration::text( Configuration::DbUser ) );
q->execute();
}
if ( !q->done() )
return;
Row * r = q->nextRow();
if ( q->failed() || !r ||
r->getBoolean( "allowed" ) == false )
{
EString s( "Refusing to start because we have too many "
"privileges on the messages table in secure "
"mode." );
result->setError( s );
l->log( s, Log::Disaster );
if ( q->failed() ) {
l->log( "Query: " + q->description(), Log::Disaster );
l->log( "Error: " + q->error(), Log::Disaster );
}
}
else {
result->setState( Query::Completed );
}
result->notify();
}