@@ -133,27 +133,29 @@ PHP_METHOD(Manager, executeQuery)
133
133
Executes a write operation batch (e.g. insert, update, delete) */
134
134
PHP_METHOD (Manager , executeWriteBatch )
135
135
{
136
- php_phongo_manager_t * intern ;
137
- zend_error_handling error_handling ;
138
- char * namespace ;
139
- int namespace_len ;
140
- zval * zbatch ;
141
- zval * writeConcern = NULL ;
136
+ php_phongo_manager_t * intern ;
137
+ zend_error_handling error_handling ;
138
+ char * namespace ;
139
+ int namespace_len ;
140
+ zval * zbatch ;
141
+ zval * zwrite_concern = NULL ;
142
142
php_phongo_writebatch_t * batch ;
143
+ php_phongo_writeconcern_t * write_concern ;
143
144
144
145
145
146
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
146
147
intern = (php_phongo_manager_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
147
148
148
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sO|O!" , & namespace , & namespace_len , & zbatch , php_phongo_writebatch_ce , & writeConcern , php_phongo_writeconcern_ce ) == FAILURE ) {
149
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sO|O!" , & namespace , & namespace_len , & zbatch , php_phongo_writebatch_ce , & zwrite_concern , php_phongo_writeconcern_ce ) == FAILURE ) {
149
150
zend_restore_error_handling (& error_handling TSRMLS_CC );
150
151
return ;
151
152
}
152
153
zend_restore_error_handling (& error_handling TSRMLS_CC );
153
154
154
155
155
156
batch = (php_phongo_writebatch_t * )zend_object_store_get_object (zbatch TSRMLS_CC );
156
- phongo_execute_write (intern -> client , namespace , batch -> batch , 0 , return_value , return_value_used TSRMLS_CC );
157
+ write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
158
+ phongo_execute_write (intern -> client , namespace , batch -> batch , write_concern -> write_concern , 0 , return_value , return_value_used TSRMLS_CC );
157
159
}
158
160
/* }}} */
159
161
/* {{{ proto MongoDB\WriteResult Manager::executeInsert(string $namespace, array|object $document[, MongoDB\WriteConcern $writeConcern = null])
@@ -165,23 +167,25 @@ PHP_METHOD(Manager, executeInsert)
165
167
char * namespace ;
166
168
int namespace_len ;
167
169
zval * document ;
168
- zval * writeConcern = NULL ;
170
+ zval * zwrite_concern = NULL ;
169
171
bson_t * bson ;
172
+ php_phongo_writeconcern_t * write_concern ;
170
173
171
174
172
175
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
173
176
intern = (php_phongo_manager_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
174
177
175
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sA|O!" , & namespace , & namespace_len , & document , & writeConcern , php_phongo_writeconcern_ce ) == FAILURE ) {
178
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sA|O!" , & namespace , & namespace_len , & document , & zwrite_concern , php_phongo_writeconcern_ce ) == FAILURE ) {
176
179
zend_restore_error_handling (& error_handling TSRMLS_CC );
177
180
return ;
178
181
}
179
182
zend_restore_error_handling (& error_handling TSRMLS_CC );
180
183
181
184
185
+ write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
182
186
bson = bson_new ();
183
187
zval_to_bson (document , PHONGO_BSON_NONE , bson , NULL TSRMLS_CC );
184
- phongo_execute_single_insert (intern -> client , namespace , bson , return_value , return_value_used TSRMLS_CC );
188
+ phongo_execute_single_insert (intern -> client , namespace , bson , write_concern -> write_concern , return_value , return_value_used TSRMLS_CC );
185
189
bson_clear (& bson );
186
190
}
187
191
/* }}} */
@@ -196,22 +200,24 @@ PHP_METHOD(Manager, executeUpdate)
196
200
zval * zquery ;
197
201
zval * newObj ;
198
202
zval * updateOptions = NULL ;
199
- zval * writeConcern = NULL ;
203
+ zval * zwrite_concern = NULL ;
200
204
bson_t * query ;
201
205
bson_t * update ;
202
206
mongoc_update_flags_t flags = MONGOC_UPDATE_NONE ;
207
+ php_phongo_writeconcern_t * write_concern ;
203
208
204
209
205
210
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
206
211
intern = (php_phongo_manager_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
207
212
208
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sAA|a!O!" , & namespace , & namespace_len , & zquery , & newObj , & updateOptions , & writeConcern , php_phongo_writeconcern_ce ) == FAILURE ) {
213
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sAA|a!O!" , & namespace , & namespace_len , & zquery , & newObj , & updateOptions , & zwrite_concern , php_phongo_writeconcern_ce ) == FAILURE ) {
209
214
zend_restore_error_handling (& error_handling TSRMLS_CC );
210
215
return ;
211
216
}
212
217
zend_restore_error_handling (& error_handling TSRMLS_CC );
213
218
214
219
220
+ write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
215
221
query = bson_new ();
216
222
update = bson_new ();
217
223
zval_to_bson (zquery , PHONGO_BSON_NONE , query , NULL TSRMLS_CC );
@@ -224,7 +230,7 @@ PHP_METHOD(Manager, executeUpdate)
224
230
flags |= MONGOC_UPDATE_MULTI_UPDATE ;
225
231
}
226
232
227
- phongo_execute_single_update (intern -> client , namespace , query , update , flags , return_value , return_value_used TSRMLS_CC );
233
+ phongo_execute_single_update (intern -> client , namespace , query , update , write_concern -> write_concern , flags , return_value , return_value_used TSRMLS_CC );
228
234
bson_clear (& query );
229
235
bson_clear (& update );
230
236
}
@@ -239,27 +245,29 @@ PHP_METHOD(Manager, executeDelete)
239
245
int namespace_len ;
240
246
zval * query ;
241
247
zval * deleteOptions = NULL ;
242
- zval * writeConcern = NULL ;
248
+ zval * zwrite_concern = NULL ;
243
249
bson_t * bson ;
244
250
mongoc_delete_flags_t flags = MONGOC_DELETE_NONE ;
251
+ php_phongo_writeconcern_t * write_concern ;
245
252
246
253
247
254
zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
248
255
intern = (php_phongo_manager_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
249
256
250
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sA|a!O!" , & namespace , & namespace_len , & query , & deleteOptions , & writeConcern , php_phongo_writeconcern_ce ) == FAILURE ) {
257
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "sA|a!O!" , & namespace , & namespace_len , & query , & deleteOptions , & zwrite_concern , php_phongo_writeconcern_ce ) == FAILURE ) {
251
258
zend_restore_error_handling (& error_handling TSRMLS_CC );
252
259
return ;
253
260
}
254
261
zend_restore_error_handling (& error_handling TSRMLS_CC );
255
262
256
263
264
+ write_concern = (php_phongo_writeconcern_t * )zend_object_store_get_object (zwrite_concern TSRMLS_CC );
257
265
if (deleteOptions && php_array_fetch_bool (deleteOptions , "limit" )) {
258
266
flags |= MONGOC_DELETE_SINGLE_REMOVE ;
259
267
}
260
268
bson = bson_new ();
261
269
zval_to_bson (query , PHONGO_BSON_NONE , bson , NULL TSRMLS_CC );
262
- phongo_execute_single_delete (intern -> client , namespace , bson , flags , return_value , return_value_used TSRMLS_CC );
270
+ phongo_execute_single_delete (intern -> client , namespace , bson , write_concern -> write_concern , flags , return_value , return_value_used TSRMLS_CC );
263
271
bson_clear (& bson );
264
272
}
265
273
/* }}} */
0 commit comments