@@ -188,6 +188,7 @@ static sb4 oci_bind_input_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, dv
188
188
{
189
189
struct pdo_bound_param_data * param = (struct pdo_bound_param_data * )ctx ;
190
190
pdo_oci_bound_param * P = (pdo_oci_bound_param * )param -> driver_data ;
191
+ zval * parameter ;
191
192
192
193
if (!param ) {
193
194
php_error_docref (NULL , E_WARNING , "param is NULL in oci_bind_input_cb; this should not happen" );
@@ -196,19 +197,24 @@ static sb4 oci_bind_input_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, dv
196
197
197
198
* indpp = & P -> indicator ;
198
199
200
+ if (Z_ISREF (param -> parameter ))
201
+ parameter = Z_REFVAL (param -> parameter );
202
+ else
203
+ parameter = & param -> parameter ;
204
+
199
205
if (P -> thing ) {
200
206
* bufpp = P -> thing ;
201
207
* alenp = sizeof (void * );
202
- } else if (ZVAL_IS_NULL (& param -> parameter )) {
208
+ } else if (ZVAL_IS_NULL (parameter )) {
203
209
/* insert a NULL value into the column */
204
210
P -> indicator = -1 ; /* NULL */
205
211
* bufpp = 0 ;
206
212
* alenp = -1 ;
207
213
} else if (!P -> thing ) {
208
214
/* regular string bind */
209
- convert_to_string (& param -> parameter );
210
- * bufpp = Z_STRVAL ( param -> parameter );
211
- * alenp = Z_STRLEN ( param -> parameter );
215
+ convert_to_string (parameter );
216
+ * bufpp = Z_STRVAL_P ( parameter );
217
+ * alenp = Z_STRLEN_P ( parameter );
212
218
}
213
219
214
220
* piecep = OCI_ONE_PIECE ;
@@ -219,12 +225,18 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d
219
225
{
220
226
struct pdo_bound_param_data * param = (struct pdo_bound_param_data * )ctx ;
221
227
pdo_oci_bound_param * P = (pdo_oci_bound_param * )param -> driver_data ;
228
+ zval * parameter ;
222
229
223
230
if (!param ) {
224
231
php_error_docref (NULL , E_WARNING , "param is NULL in oci_bind_output_cb; this should not happen" );
225
232
return OCI_ERROR ;
226
233
}
227
234
235
+ if (Z_ISREF (param -> parameter ))
236
+ parameter = Z_REFVAL (param -> parameter );
237
+ else
238
+ parameter = & param -> parameter ;
239
+
228
240
if (PDO_PARAM_TYPE (param -> param_type ) == PDO_PARAM_LOB ) {
229
241
P -> actual_len = sizeof (OCILobLocator * );
230
242
* bufpp = P -> thing ;
@@ -235,20 +247,20 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d
235
247
return OCI_CONTINUE ;
236
248
}
237
249
238
- if (Z_TYPE ( param -> parameter ) == IS_OBJECT || Z_TYPE ( param -> parameter ) == IS_RESOURCE ) {
250
+ if (Z_TYPE_P ( parameter ) == IS_OBJECT || Z_TYPE_P ( parameter ) == IS_RESOURCE ) {
239
251
return OCI_CONTINUE ;
240
252
}
241
253
242
- convert_to_string (& param -> parameter );
243
- zval_dtor (& param -> parameter );
254
+ convert_to_string (parameter );
255
+ zval_dtor (parameter );
244
256
245
- Z_STRLEN ( param -> parameter ) = param -> max_value_len ;
246
- Z_STR ( param -> parameter ) = ecalloc (1 , Z_STRLEN ( param -> parameter )+ 1 );
257
+ Z_STRLEN_P ( parameter ) = param -> max_value_len ;
258
+ Z_STR_P ( parameter ) = ecalloc (1 , Z_STRLEN_P ( parameter )+ 1 );
247
259
P -> used_for_output = 1 ;
248
260
249
- P -> actual_len = Z_STRLEN ( param -> parameter );
261
+ P -> actual_len = Z_STRLEN_P ( parameter );
250
262
* alenpp = & P -> actual_len ;
251
- * bufpp = Z_STRVAL ( param -> parameter );
263
+ * bufpp = Z_STRVAL_P ( parameter );
252
264
* piecep = OCI_ONE_PIECE ;
253
265
* rcodepp = & P -> retcode ;
254
266
* indpp = & P -> indicator ;
@@ -264,6 +276,12 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
264
276
if (param -> is_param ) {
265
277
pdo_oci_bound_param * P ;
266
278
sb4 value_sz = -1 ;
279
+ zval * parameter ;
280
+
281
+ if (Z_ISREF (param -> parameter ))
282
+ parameter = Z_REFVAL (param -> parameter );
283
+ else
284
+ parameter = & param -> parameter ;
267
285
268
286
P = (pdo_oci_bound_param * )param -> driver_data ;
269
287
@@ -343,29 +361,29 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
343
361
if (P -> used_for_output ) {
344
362
if (P -> indicator == -1 ) {
345
363
/* set up a NULL value */
346
- if (Z_TYPE ( param -> parameter ) == IS_STRING ) {
364
+ if (Z_TYPE_P ( parameter ) == IS_STRING ) {
347
365
/* OCI likes to stick non-terminated strings in things */
348
- * Z_STRVAL ( param -> parameter ) = '\0' ;
366
+ * Z_STRVAL_P ( parameter ) = '\0' ;
349
367
}
350
- zval_dtor (& param -> parameter );
351
- ZVAL_UNDEF (& param -> parameter );
352
- } else if (Z_TYPE ( param -> parameter ) == IS_STRING ) {
353
- Z_STRLEN ( param -> parameter ) = P -> actual_len ;
354
- Z_STR ( param -> parameter ) = erealloc (Z_STRVAL ( param -> parameter ), P -> actual_len + 1 );
355
- Z_STRVAL ( param -> parameter )[P -> actual_len ] = '\0' ;
368
+ zval_dtor (parameter );
369
+ ZVAL_UNDEF (parameter );
370
+ } else if (Z_TYPE_P ( parameter ) == IS_STRING ) {
371
+ Z_STRLEN_P ( parameter ) = P -> actual_len ;
372
+ Z_STR_P ( parameter ) = erealloc (Z_STRVAL_P ( parameter ), P -> actual_len + 1 );
373
+ Z_STRVAL_P ( parameter )[P -> actual_len ] = '\0' ;
356
374
}
357
375
} else if (PDO_PARAM_TYPE (param -> param_type ) == PDO_PARAM_LOB && P -> thing ) {
358
376
php_stream * stm ;
359
377
360
- if (Z_TYPE ( param -> parameter ) == IS_NULL ) {
378
+ if (Z_TYPE_P ( parameter ) == IS_NULL ) {
361
379
/* if the param is NULL, then we assume that they
362
380
* wanted to bind a lob locator into it from the query
363
381
* */
364
382
365
383
stm = oci_create_lob_stream (stmt , (OCILobLocator * )P -> thing );
366
384
if (stm ) {
367
385
OCILobOpen (S -> H -> svc , S -> err , (OCILobLocator * )P -> thing , OCI_LOB_READWRITE );
368
- php_stream_to_zval (stm , & param -> parameter );
386
+ php_stream_to_zval (stm , parameter );
369
387
P -> thing = NULL ;
370
388
}
371
389
} else {
@@ -374,7 +392,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
374
392
ub4 amt , offset = 1 ;
375
393
char * consume ;
376
394
377
- php_stream_from_zval_no_verify (stm , & param -> parameter );
395
+ php_stream_from_zval_no_verify (stm , parameter );
378
396
if (stm ) {
379
397
OCILobOpen (S -> H -> svc , S -> err , (OCILobLocator * )P -> thing , OCI_LOB_READWRITE );
380
398
do {
@@ -397,10 +415,10 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
397
415
} while (1 );
398
416
OCILobClose (S -> H -> svc , S -> err , (OCILobLocator * )P -> thing );
399
417
OCILobFlushBuffer (S -> H -> svc , S -> err , (OCILobLocator * )P -> thing , 0 );
400
- } else if (Z_TYPE ( param -> parameter ) == IS_STRING ) {
418
+ } else if (Z_TYPE_P ( parameter ) == IS_STRING ) {
401
419
/* stick the string into the LOB */
402
- consume = Z_STRVAL ( param -> parameter );
403
- n = Z_STRLEN ( param -> parameter );
420
+ consume = Z_STRVAL_P ( parameter );
421
+ n = Z_STRLEN_P ( parameter );
404
422
if (n ) {
405
423
OCILobOpen (S -> H -> svc , S -> err , (OCILobLocator * )P -> thing , OCI_LOB_READWRITE );
406
424
while (n ) {
@@ -651,7 +669,7 @@ static int oci_blob_close(php_stream *stream, int close_handle)
651
669
efree (self );
652
670
}
653
671
654
- php_pdo_free_statement (stmt );
672
+ /* php_pdo_free_statement(stmt); */
655
673
return 0 ;
656
674
}
657
675
0 commit comments