本文整理汇总了C++中Query::bindNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::bindNull方法的具体用法?C++ Query::bindNull怎么用?C++ Query::bindNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::bindNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Query * Mailbox::create( Transaction * t, User * owner )
{
Query * q;
if ( deleted() ) {
q = new Query( "update mailboxes "
"set deleted='f',owner=$2,first_recent=uidnext,flag=$3 "
"where id=$1", 0 );
q->bind( 1, id() );
}
else if ( id() == 0 ) {
q = new Query( "insert into mailboxes "
"(name,owner,uidnext,uidvalidity,deleted,flag) "
"values ($1,$2,1,1,'f',$3)", 0 );
q->bind( 1, name() );
}
else {
return 0;
}
if ( owner )
q->bind( 2, owner->id() );
else
q->bindNull( 2 );
if ( !d->flag.isEmpty() )
q->bind( 3, d->flag );
else
q->bindNull( 3 );
t->enqueue( q );
// We assume that the caller has checked permissions.
Mailbox * m = parent();
while ( m ) {
Query * q = 0;
if ( m->deleted() ) {
// Should we leave it be or undelete it?
}
else if ( m->id() == 0 ) {
q = new Query( "insert into mailboxes "
"(name,owner,uidnext,uidvalidity,deleted) "
"values ($1,null,1,1,'f')", 0 );
q->bind( 1, m->name() );
}
// We rely on the trigger to set the ownership of the
// intermediate mailboxes being created.
if ( q )
t->enqueue( q );
m = m->parent();
}
t->enqueue( new Query( "notify mailboxes_updated", 0 ) );
return q;
}
示例2: Deliverator
Deliverator( Injectee * message,
const UString & mailbox, const EString & user )
: q( 0 ), i( 0 ), m( message ), mbn( mailbox ), un( user ),
p( 0 ), mb( 0 )
{
Allocator::addEternal( this, "deliver object" );
q = new Query( "select al.mailbox, n.name as namespace, u.login "
"from aliases al "
"join addresses a on (al.address=a.id) "
"left join users u on (al.id=u.alias) "
"left join namespaces n on (u.parentspace=n.id) "
"where (lower(a.localpart)=$1 and lower(a.domain)=$2) "
"or (lower(u.login)=$3)", this );
if ( user.contains( '@' ) ) {
int at = user.find( '@' );
q->bind( 1, user.mid( 0, at ).lower() );
q->bind( 2, user.mid( at + 1 ).lower() );
}
else {
q->bindNull( 1 );
q->bindNull( 2 );
}
q->bind( 3, user.lower() );
q->execute();
}