28
28
29
29
zend_class_entry * php_phongo_serverdescription_ce ;
30
30
31
+ #define PHONGO_SERVER_UNKNOWN "Unknown"
32
+ #define PHONGO_SERVER_STANDALONE "Standalone"
33
+ #define PHONGO_SERVER_MONGOS "Mongos"
34
+ #define PHONGO_SERVER_POSSIBLE_PRIMARY "PossiblePrimary"
35
+ #define PHONGO_SERVER_RS_PRIMARY "RSPrimary"
36
+ #define PHONGO_SERVER_RS_SECONDARY "RSSecondary"
37
+ #define PHONGO_SERVER_RS_ARBITER "RSArbiter"
38
+ #define PHONGO_SERVER_RS_OTHER "RSOther"
39
+ #define PHONGO_SERVER_RS_GHOST "RSGhost"
40
+
31
41
/* {{{ proto array MongoDB\Driver\ServerDescription::getHelloResponse()
32
42
Returns the most recent "hello" response */
33
43
static PHP_METHOD (ServerDescription , getHelloResponse )
@@ -105,7 +115,7 @@ static PHP_METHOD(ServerDescription, getRoundTripTime)
105
115
RETVAL_LONG (mongoc_server_description_round_trip_time (intern -> server_description ));
106
116
} /* }}} */
107
117
108
- /* {{{ proto integer MongoDB\Driver\ServerDescription::getType()
118
+ /* {{{ proto string MongoDB\Driver\ServerDescription::getType()
109
119
Returns the server’s node type */
110
120
static PHP_METHOD (ServerDescription , getType )
111
121
{
@@ -115,7 +125,7 @@ static PHP_METHOD(ServerDescription, getType)
115
125
116
126
PHONGO_PARSE_PARAMETERS_NONE ();
117
127
118
- RETVAL_LONG ( php_phongo_server_description_type (intern -> server_description ));
128
+ RETVAL_STRING ( mongoc_server_description_type (intern -> server_description ));
119
129
} /* }}} */
120
130
121
131
/* {{{ MongoDB\Driver\ServerDescription function entries */
@@ -192,7 +202,7 @@ HashTable* php_phongo_serverdescription_get_properties_hash(phongo_compat_object
192
202
ZVAL_LONG (& port , host_list -> port );
193
203
zend_hash_str_update (props , "port" , sizeof ("port" ) - 1 , & port );
194
204
195
- ZVAL_LONG (& type , php_phongo_server_description_type (intern -> server_description ));
205
+ ZVAL_STRING (& type , mongoc_server_description_type (intern -> server_description ));
196
206
zend_hash_str_update (props , "type" , sizeof ("type" ) - 1 , & type );
197
207
}
198
208
@@ -250,15 +260,15 @@ void php_phongo_serverdescription_init_ce(INIT_FUNC_ARGS) /* {{{ */
250
260
php_phongo_handler_serverdescription .free_obj = php_phongo_serverdescription_free_object ;
251
261
php_phongo_handler_serverdescription .offset = XtOffsetOf (php_phongo_serverdescription_t , std );
252
262
253
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_UNKNOWN" ), PHONGO_SERVER_UNKNOWN );
254
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_STANDALONE" ), PHONGO_SERVER_STANDALONE );
255
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_MONGOS" ), PHONGO_SERVER_MONGOS );
256
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_POSSIBLE_PRIMARY" ), PHONGO_SERVER_POSSIBLE_PRIMARY );
257
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_PRIMARY" ), PHONGO_SERVER_RS_PRIMARY );
258
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_SECONDARY" ), PHONGO_SERVER_RS_SECONDARY );
259
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_ARBITER" ), PHONGO_SERVER_RS_ARBITER );
260
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_OTHER" ), PHONGO_SERVER_RS_OTHER );
261
- zend_declare_class_constant_long (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_GHOST" ), PHONGO_SERVER_RS_GHOST );
263
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_UNKNOWN" ), PHONGO_SERVER_UNKNOWN );
264
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_STANDALONE" ), PHONGO_SERVER_STANDALONE );
265
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_MONGOS" ), PHONGO_SERVER_MONGOS );
266
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_POSSIBLE_PRIMARY" ), PHONGO_SERVER_POSSIBLE_PRIMARY );
267
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_PRIMARY" ), PHONGO_SERVER_RS_PRIMARY );
268
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_SECONDARY" ), PHONGO_SERVER_RS_SECONDARY );
269
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_ARBITER" ), PHONGO_SERVER_RS_ARBITER );
270
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_OTHER" ), PHONGO_SERVER_RS_OTHER );
271
+ zend_declare_class_constant_string (php_phongo_serverdescription_ce , ZEND_STRL ("TYPE_RS_GHOST" ), PHONGO_SERVER_RS_GHOST );
262
272
} /* }}} */
263
273
264
274
/*
0 commit comments