本文整理汇总了C++中mongoParser::more方法的典型用法代码示例。如果您正苦于以下问题:C++ mongoParser::more方法的具体用法?C++ mongoParser::more怎么用?C++ mongoParser::more使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mongoParser
的用法示例。
在下文中一共展示了mongoParser::more方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertRequest
INT32 dropDatabaseCommand::convertRequest( mongoParser &parser, msgBuffer &sdbMsg )
{
INT32 rc = SDB_OK ;
INT32 nToSkip = 0 ;
INT32 nToReturn = 0 ;
MsgHeader *header = NULL ;
MsgOpQuery *query = NULL ;
bson::BSONObj cond ;
bson::BSONObj obj ;
bson::BSONElement e ;
const std::string cmdStr = "$drop collectionspace" ;
parser.opType = OP_CMD_DROP_DATABASE ;
sdbMsg.reverse( sizeof ( MsgOpQuery ) ) ;
sdbMsg.advance( sizeof ( MsgOpQuery ) - 4 ) ;
header = ( MsgHeader * )sdbMsg.data() ;
header->opCode = MSG_BS_QUERY_REQ ;
header->TID = 0 ;
header->routeID.value = 0 ;
header->requestID = parser.id ;
query = ( MsgOpQuery * )sdbMsg.data() ;
query->version = 0 ;
query->w = 0 ;
query->padding = 0 ;
query->flags = 0 ;
fap::setQueryFlags( parser.reservedFlags, query->flags ) ;
query->nameLength = cmdStr.length() ;
parser.skip( parser.nsLen + 1 ) ;
parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToSkip ) ;
parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToReturn ) ;
if ( parser.more() )
{
parser.nextObj( cond ) ;
}
query->nameLength = cmdStr.length() ;
sdbMsg.write( cmdStr.c_str(), query->nameLength + 1, TRUE ) ;
obj = BSON( "Name" << parser.csName ) ;
query->numToSkip = nToSkip ;
query->numToReturn = nToReturn ;
sdbMsg.write( obj, TRUE ) ;
sdbMsg.write( fap::emptyObj, TRUE ) ;
sdbMsg.write( fap::emptyObj, TRUE ) ;
sdbMsg.write( fap::emptyObj, TRUE ) ;
sdbMsg.doneLen() ;
return rc ;
}
示例2: convertRequest
INT32 countCommand::convertRequest( mongoParser &parser,
std::vector<msgBuffer*> &sdbMsgs )
{
INT32 rc = SDB_OK ;
INT32 nToSkip = 0 ;
INT32 nToReturn = 0 ;
MsgHeader *header = NULL ;
MsgOpQuery *query = NULL ;
bson::BSONObj cond ;
bson::BSONObj queryObj ;
bson::BSONObj orderby ;
bson::BSONObj fields ;
bson::BSONObjBuilder obj ;
bson::BSONElement e ;
const std::string cmdStr = "$get count" ;
std::string fullname ;
msgBuffer *sdbMsg = SDB_OSS_NEW msgBuffer() ;
if ( NULL == sdbMsg )
{
rc = SDB_OOM ;
goto error ;
}
parser.opType = OP_CMD_COUNT ;
sdbMsg->reverse( sizeof ( MsgOpQuery ) ) ;
sdbMsg->advance( sizeof ( MsgOpQuery ) - 4 ) ;
header = ( MsgHeader * )sdbMsg->data() ;
header->opCode = MSG_BS_QUERY_REQ ;
header->TID = 0 ;
header->routeID.value = 0 ;
header->requestID = parser.id ;
query = ( MsgOpQuery * )sdbMsg->data() ;
query->version = 0 ;
query->w = 0 ;
query->padding = 0 ;
query->flags = 0 ;
fullname = parser.csName ;
query->nameLength = cmdStr.length() ;
parser.skip( parser.nsLen + 1 ) ;
parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToSkip ) ;
parser.readNumber( sizeof( INT32 ), ( CHAR * )&nToReturn ) ;
if ( parser.more() )
{
parser.nextObj( cond ) ;
}
fullname += "." ;
fullname += cond.getStringField( "count" ) ;
query->nameLength = cmdStr.length() ;
sdbMsg->write( cmdStr.c_str(), query->nameLength + 1, TRUE ) ;
obj.append( "Collection", fullname.c_str() ) ;
queryObj = cond.getObjectField( "query" ) ;
orderby = queryObj.getObjectField( "sort" ) ;
queryObj = removeField( queryObj, "sort" ) ;
nToReturn = cond.getIntField( "limit" ) ;
nToSkip = cond.getIntField( "skip" ) ;
query->numToSkip = nToSkip ;
query->numToReturn = nToReturn ;
sdbMsg->write( queryObj, TRUE ) ;
sdbMsg->write( fields, TRUE ) ;
sdbMsg->write( orderby, TRUE ) ;
sdbMsg->write( obj.done(), TRUE ) ;
header->messageLength = sdbMsg->size() ;
sdbMsgs.push_back( sdbMsg ) ;
done:
return rc ;
error:
goto done ;
}