40
40
#define OCI_STMT_CALL 10
41
41
#endif
42
42
43
+ #define Z_OCILOB_DESCRIPTOR_P (zv ) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
44
+
43
45
#define ERROR_ARG_POS (arg_num ) (getThis() ? (arg_num-1) : (arg_num))
44
46
45
47
/* {{{ Register a callback function for Oracle Transparent Application Failover (TAF) */
@@ -233,10 +235,7 @@ PHP_FUNCTION(oci_free_descriptor)
233
235
RETURN_THROWS ();
234
236
}
235
237
236
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
237
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
238
- RETURN_FALSE ;
239
- }
238
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
240
239
241
240
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
242
241
@@ -264,10 +263,7 @@ PHP_FUNCTION(oci_lob_save)
264
263
RETURN_THROWS ();
265
264
}
266
265
267
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
268
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
269
- RETURN_FALSE ;
270
- }
266
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
271
267
272
268
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
273
269
@@ -290,10 +286,7 @@ PHP_FUNCTION(oci_lob_import)
290
286
RETURN_THROWS ();
291
287
}
292
288
293
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
294
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
295
- RETURN_FALSE ;
296
- }
289
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
297
290
298
291
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
299
292
@@ -316,10 +309,7 @@ PHP_FUNCTION(oci_lob_load)
316
309
RETURN_THROWS ();
317
310
}
318
311
319
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
320
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
321
- RETURN_FALSE ;
322
- }
312
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
323
313
324
314
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
325
315
@@ -356,10 +346,7 @@ PHP_FUNCTION(oci_lob_read)
356
346
RETURN_THROWS ();
357
347
}
358
348
359
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
360
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
361
- RETURN_FALSE ;
362
- }
349
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
363
350
364
351
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
365
352
@@ -388,10 +375,7 @@ PHP_FUNCTION(oci_lob_eof)
388
375
RETURN_THROWS ();
389
376
}
390
377
391
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
392
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
393
- RETURN_FALSE ;
394
- }
378
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
395
379
396
380
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
397
381
@@ -414,11 +398,7 @@ PHP_FUNCTION(oci_lob_tell)
414
398
RETURN_THROWS ();
415
399
}
416
400
417
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
418
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
419
- RETURN_FALSE ;
420
- }
421
-
401
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
422
402
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
423
403
424
404
RETURN_LONG (descriptor -> lob_current_position );
@@ -435,10 +415,7 @@ PHP_FUNCTION(oci_lob_rewind)
435
415
RETURN_THROWS ();
436
416
}
437
417
438
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
439
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
440
- RETURN_FALSE ;
441
- }
418
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
442
419
443
420
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
444
421
@@ -460,10 +437,7 @@ PHP_FUNCTION(oci_lob_seek)
460
437
RETURN_THROWS ();
461
438
}
462
439
463
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
464
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
465
- RETURN_FALSE ;
466
- }
440
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
467
441
468
442
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
469
443
@@ -507,10 +481,7 @@ PHP_FUNCTION(oci_lob_size)
507
481
RETURN_THROWS ();
508
482
}
509
483
510
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
511
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
512
- RETURN_FALSE ;
513
- }
484
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
514
485
515
486
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
516
487
@@ -540,11 +511,7 @@ PHP_FUNCTION(oci_lob_write)
540
511
data_len = MIN ((zend_long ) data_len , write_len );
541
512
}
542
513
543
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
544
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
545
- RETURN_FALSE ;
546
- }
547
-
514
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
548
515
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
549
516
550
517
if (data_len <= 0 ) {
@@ -568,15 +535,8 @@ PHP_FUNCTION(oci_lob_append)
568
535
RETURN_THROWS ();
569
536
}
570
537
571
- if ((tmp_dest = zend_hash_str_find (Z_OBJPROP_P (z_descriptor_dest ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
572
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property. The first argument should be valid descriptor object" );
573
- RETURN_FALSE ;
574
- }
575
-
576
- if ((tmp_from = zend_hash_str_find (Z_OBJPROP_P (z_descriptor_from ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
577
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property. The second argument should be valid descriptor object" );
578
- RETURN_FALSE ;
579
- }
538
+ tmp_dest = Z_OCILOB_DESCRIPTOR_P (z_descriptor_dest );
539
+ tmp_from = Z_OCILOB_DESCRIPTOR_P (z_descriptor_from );
580
540
581
541
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_dest , descriptor_dest );
582
542
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_from , descriptor_from );
@@ -606,10 +566,7 @@ PHP_FUNCTION(oci_lob_truncate)
606
566
RETURN_THROWS ();
607
567
}
608
568
609
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
610
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
611
- RETURN_FALSE ;
612
- }
569
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
613
570
614
571
ub_trim_length = (ub4 ) trim_length ;
615
572
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
@@ -648,11 +605,7 @@ PHP_FUNCTION(oci_lob_erase)
648
605
RETURN_THROWS ();
649
606
}
650
607
651
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
652
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
653
- RETURN_FALSE ;
654
- }
655
-
608
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
656
609
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
657
610
658
611
if (php_oci_lob_erase (descriptor , offset , (ub4 ) length , & bytes_erased )) {
@@ -673,11 +626,7 @@ PHP_FUNCTION(oci_lob_flush)
673
626
RETURN_THROWS ();
674
627
}
675
628
676
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
677
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
678
- RETURN_FALSE ;
679
- }
680
-
629
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
681
630
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
682
631
683
632
if (descriptor -> buffering == PHP_OCI_LOB_BUFFER_DISABLED ) {
@@ -703,11 +652,7 @@ PHP_FUNCTION(ocisetbufferinglob)
703
652
RETURN_THROWS ();
704
653
}
705
654
706
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
707
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
708
- RETURN_FALSE ;
709
- }
710
-
655
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
711
656
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
712
657
713
658
if (php_oci_lob_set_buffering (descriptor , flag )) {
@@ -727,11 +672,7 @@ PHP_FUNCTION(ocigetbufferinglob)
727
672
RETURN_THROWS ();
728
673
}
729
674
730
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
731
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
732
- RETURN_FALSE ;
733
- }
734
-
675
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
735
676
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
736
677
737
678
if (descriptor -> buffering != PHP_OCI_LOB_BUFFER_DISABLED ) {
@@ -760,15 +701,8 @@ PHP_FUNCTION(oci_lob_copy)
760
701
RETURN_THROWS ();
761
702
}
762
703
763
- if ((tmp_dest = zend_hash_str_find (Z_OBJPROP_P (z_descriptor_dest ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
764
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property. The first argument should be valid descriptor object" );
765
- RETURN_FALSE ;
766
- }
767
-
768
- if ((tmp_from = zend_hash_str_find (Z_OBJPROP_P (z_descriptor_from ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
769
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property. The second argument should be valid descriptor object" );
770
- RETURN_FALSE ;
771
- }
704
+ tmp_dest = Z_OCILOB_DESCRIPTOR_P (z_descriptor_dest );
705
+ tmp_from = Z_OCILOB_DESCRIPTOR_P (z_descriptor_from );
772
706
773
707
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_dest , descriptor_dest );
774
708
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_from , descriptor_from );
@@ -791,15 +725,8 @@ PHP_FUNCTION(oci_lob_is_equal)
791
725
RETURN_THROWS ();
792
726
}
793
727
794
- if ((tmp_first = zend_hash_str_find (Z_OBJPROP_P (z_descriptor_first ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
795
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property. The first argument should be valid descriptor object" );
796
- RETURN_FALSE ;
797
- }
798
-
799
- if ((tmp_second = zend_hash_str_find (Z_OBJPROP_P (z_descriptor_second ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
800
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property. The second argument should be valid descriptor object" );
801
- RETURN_FALSE ;
802
- }
728
+ tmp_first = Z_OCILOB_DESCRIPTOR_P (z_descriptor_first );
729
+ tmp_second = Z_OCILOB_DESCRIPTOR_P (z_descriptor_second );
803
730
804
731
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_first , descriptor_first );
805
732
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_second , descriptor_second );
@@ -846,10 +773,7 @@ PHP_FUNCTION(oci_lob_export)
846
773
RETURN_THROWS ();
847
774
}
848
775
849
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
850
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
851
- RETURN_FALSE ;
852
- }
776
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
853
777
854
778
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
855
779
@@ -928,10 +852,7 @@ PHP_METHOD(OCILob, writeTemporary)
928
852
RETURN_THROWS ();
929
853
}
930
854
931
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
932
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
933
- RETURN_FALSE ;
934
- }
855
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
935
856
936
857
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
937
858
@@ -952,11 +873,7 @@ PHP_METHOD(OCILob, close)
952
873
RETURN_THROWS ();
953
874
}
954
875
955
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
956
- php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
957
- RETURN_FALSE ;
958
- }
959
-
876
+ tmp = Z_OCILOB_DESCRIPTOR_P (z_descriptor );
960
877
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
961
878
962
879
if (php_oci_lob_close (descriptor )) {
@@ -988,7 +905,7 @@ PHP_FUNCTION(oci_new_descriptor)
988
905
}
989
906
990
907
object_init_ex (return_value , oci_lob_class_entry_ptr );
991
- add_property_resource ( return_value , "descriptor" , descriptor -> id );
908
+ ZVAL_RES ( Z_OCILOB_DESCRIPTOR_P ( return_value ) , descriptor -> id );
992
909
}
993
910
/* }}} */
994
911
0 commit comments