@@ -58,48 +58,50 @@ PHP_METHOD(Server, __construct)
5858 phongo_throw_exception (PHONGO_ERROR_RUNTIME TSRMLS_CC , "Accessing private constructor" );
5959}
6060/* }}} */
61- /* {{{ proto MongoDB\Driver\Cursor Server::executeCommand(string $db, MongoDB\Driver\Command $command)
61+ /* {{{ proto MongoDB\Driver\Cursor Server::executeCommand(string $db, MongoDB\Driver\Command $command[, MongoDB\Driver\ReadPreference $readPreference = null]) )
6262 Executes a command on this server */
6363PHP_METHOD (Server , executeCommand )
6464{
6565 php_phongo_server_t * intern ;
6666 char * db ;
6767 int db_len ;
6868 zval * command ;
69+ zval * readPreference = NULL ;
6970 php_phongo_command_t * cmd ;
7071 (void )return_value_ptr ;
7172
7273
7374 intern = (php_phongo_server_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
7475
75- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sO" , & db , & db_len , & command , php_phongo_command_ce ) == FAILURE ) {
76+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sO|O! " , & db , & db_len , & command , php_phongo_command_ce , & readPreference , php_phongo_readpreference_ce ) == FAILURE ) {
7677 return ;
7778 }
7879
7980
8081 cmd = (php_phongo_command_t * )zend_object_store_get_object (command TSRMLS_CC );
81- phongo_execute_command (intern -> client , db , cmd -> bson , NULL , intern -> server_id , return_value , return_value_used TSRMLS_CC );
82+ phongo_execute_command (intern -> client , db , cmd -> bson , phongo_read_preference_from_zval ( readPreference TSRMLS_CC ) , intern -> server_id , return_value , return_value_used TSRMLS_CC );
8283}
8384/* }}} */
84- /* {{{ proto MongoDB\Driver\Cursor Server::executeQuery(string $namespace, MongoDB\Driver\Query $zquery)
85+ /* {{{ proto MongoDB\Driver\Cursor Server::executeQuery(string $namespace, MongoDB\Driver\Query $zquery[, MongoDB\Driver\ReadPreference $readPreference = null]) )
8586 Executes a Query */
8687PHP_METHOD (Server , executeQuery )
8788{
8889 php_phongo_server_t * intern ;
8990 char * namespace ;
9091 int namespace_len ;
9192 zval * zquery ;
93+ zval * readPreference = NULL ;
9294 (void )return_value_ptr ;
9395
9496
9597 intern = (php_phongo_server_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
9698
97- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sO" , & namespace , & namespace_len , & zquery , php_phongo_query_ce ) == FAILURE ) {
99+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sO|O! " , & namespace , & namespace_len , & zquery , php_phongo_query_ce , & readPreference , php_phongo_readpreference_ce ) == FAILURE ) {
98100 return ;
99101 }
100102
101103
102- phongo_execute_query (intern -> client , namespace , phongo_query_from_zval (zquery TSRMLS_CC ), NULL , intern -> server_id , return_value , return_value_used TSRMLS_CC );
104+ phongo_execute_query (intern -> client , namespace , phongo_query_from_zval (zquery TSRMLS_CC ), phongo_read_preference_from_zval ( readPreference TSRMLS_CC ) , intern -> server_id , return_value , return_value_used TSRMLS_CC );
103105}
104106/* }}} */
105107/* {{{ proto MongoDB\Driver\WriteResult Server::executeBulkWrite(string $namespace, MongoDB\Driver\BulkWrite $zbulk[, MongoDB\Driver\WriteConcern $writeConcern = null])
@@ -391,11 +393,13 @@ PHP_METHOD(Server, isPassive)
391393ZEND_BEGIN_ARG_INFO_EX (ai_Server_executeCommand , 0 , 0 , 2 )
392394 ZEND_ARG_INFO (0 , db )
393395 ZEND_ARG_OBJ_INFO (0 , command , MongoDB \\Driver \\Command , 0 )
396+ ZEND_ARG_OBJ_INFO (0 , readPreference , MongoDB \\Driver \\ReadPreference , 1 )
394397ZEND_END_ARG_INFO ();
395398
396399ZEND_BEGIN_ARG_INFO_EX (ai_Server_executeQuery , 0 , 0 , 2 )
397400 ZEND_ARG_INFO (0 , namespace )
398401 ZEND_ARG_OBJ_INFO (0 , zquery , MongoDB \\Driver \\Query , 0 )
402+ ZEND_ARG_OBJ_INFO (0 , readPreference , MongoDB \\Driver \\ReadPreference , 1 )
399403ZEND_END_ARG_INFO ();
400404
401405ZEND_BEGIN_ARG_INFO_EX (ai_Server_executeBulkWrite , 0 , 0 , 2 )
0 commit comments