Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit a143f81

Browse files
committed
HHVM-32: Implemented MongoDB/Driver/Server::executeQuery()
1 parent e2871b4 commit a143f81

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

ext_mongodb.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ final public function getInfo(): array;
256256

257257
<<__Native>>
258258
function executeCommand(string $db, Command $command, ReadPreference $readPreference = null): Cursor;
259+
260+
<<__Native>>
261+
function executeQuery(string $namespace, Query $query, ReadPreference $readPreference = null): Cursor;
259262
}
260263

261264
<<__NativeData("MongoDBDriverWriteResult")>>

mongodb.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ static class MongoDBExtension : public Extension {
146146

147147
/* MongoDb\Driver\Server */
148148
HHVM_MALIAS(MongoDB\\Driver\\Server, executeCommand, MongoDBDriverServer, executeCommand);
149+
HHVM_MALIAS(MongoDB\\Driver\\Server, executeQuery, MongoDBDriverServer, executeQuery);
149150
HHVM_MALIAS(MongoDB\\Driver\\Server, getInfo, MongoDBDriverServer, getInfo);
150151

151152
Native::registerNativeDataInfo<MongoDBDriverServerData>(MongoDBDriverServerData::s_className.get());

src/MongoDB/Driver/Server.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,16 @@ Object HHVM_METHOD(MongoDBDriverServer, executeCommand, const String &db, const
6868
);
6969
}
7070

71+
Object HHVM_METHOD(MongoDBDriverServer, executeQuery, const String &ns, const Object &query, const Variant &ReadPreference)
72+
{
73+
MongoDBDriverServerData* data = Native::data<MongoDBDriverServerData>(this_);
74+
75+
return MongoDriver::Utils::doExecuteQuery(
76+
ns,
77+
data->m_client,
78+
query,
79+
NULL
80+
);
81+
}
82+
7183
}

src/MongoDB/Driver/Server.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class MongoDBDriverServerData
5353

5454
Array HHVM_METHOD(MongoDBDriverServer, getInfo);
5555
Object HHVM_METHOD(MongoDBDriverServer, executeCommand, const String &db, const Object &command, const Variant &readPreference);
56+
Object HHVM_METHOD(MongoDBDriverServer, executeQuery, const String &ns, const Object &quuery, const Variant &ReadPreference);
5657

5758
}
5859
#endif

0 commit comments

Comments
 (0)