当前位置: 首页>>代码示例>>C++>>正文


C++ Query::bindNull方法代码示例

本文整理汇总了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;
}
开发者ID:aox,项目名称:aox,代码行数:60,代码来源:mailbox.cpp

示例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();
 }
开发者ID:copernicus,项目名称:aox,代码行数:25,代码来源:deliver.cpp


注:本文中的Query::bindNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。