moving DBDirectClient to instance.* b/c it only make sense there and cleans linking
This commit is contained in:
@@ -505,3 +505,34 @@ void dbexit(int rc, const char *why) {
|
||||
log() << " dbexit: really exiting now" << endl;
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
|
||||
auto_ptr<DBClientCursor> DBDirectClient::query(const char *ns, BSONObj query, int nToReturn , int nToSkip ,
|
||||
BSONObj *fieldsToReturn , int queryOptions ){
|
||||
|
||||
auto_ptr<DBClientCursor> c( new DBClientCursor( new DirectConnector() , ns ,
|
||||
query , nToReturn , nToSkip , fieldsToReturn , queryOptions ));
|
||||
if ( c->init() )
|
||||
return c;
|
||||
|
||||
return auto_ptr< DBClientCursor >( 0 );
|
||||
}
|
||||
|
||||
BSONObj DBDirectClient::findOne(const char *ns, BSONObj query, BSONObj *fieldsToReturn , int queryOptions ){
|
||||
auto_ptr<DBClientCursor> c =
|
||||
this->query(ns, query, 1, 0, fieldsToReturn, queryOptions);
|
||||
|
||||
if ( ! c->more() )
|
||||
return BSONObj();
|
||||
|
||||
return c->next().copy();
|
||||
}
|
||||
|
||||
|
||||
bool DirectConnector::send( Message &toSend, Message &response, bool assertOk ){
|
||||
DbResponse dbResponse;
|
||||
assembleResponse( toSend, dbResponse );
|
||||
assert( dbResponse.response );
|
||||
response = *dbResponse.response;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user