41
41
/* {{{ php_oci_collection_create()
42
42
Create and return connection handle */
43
43
php_oci_collection * php_oci_collection_create (php_oci_connection * connection , char * tdo , int tdo_len , char * schema , int schema_len )
44
- {
44
+ {
45
45
dvoid * dschp1 = NULL ;
46
46
dvoid * parmp1 ;
47
47
dvoid * parmp2 ;
48
48
php_oci_collection * collection ;
49
49
sword errstatus ;
50
-
50
+
51
51
collection = emalloc (sizeof (php_oci_collection ));
52
52
53
53
collection -> connection = connection ;
@@ -195,7 +195,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch
195
195
default :
196
196
php_error_docref (NULL , E_WARNING , "unknown collection type %d" , collection -> coll_typecode );
197
197
break ;
198
- }
198
+ }
199
199
200
200
/* Create object to hold return table */
201
201
PHP_OCI_CALL_RETURN (errstatus , OCIObjectNew ,
@@ -221,7 +221,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch
221
221
PHP_OCI_REGISTER_RESOURCE (collection , le_collection );
222
222
connection -> errcode = 0 ; /* retain backwards compat with OCI8 1.4 */
223
223
return collection ;
224
-
224
+
225
225
CLEANUP :
226
226
227
227
if (dschp1 ) {
@@ -230,7 +230,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch
230
230
}
231
231
connection -> errcode = php_oci_error (connection -> err , errstatus );
232
232
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
233
- php_oci_collection_close (collection );
233
+ php_oci_collection_close (collection );
234
234
return NULL ;
235
235
}
236
236
/* }}} */
@@ -241,7 +241,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size)
241
241
{
242
242
php_oci_connection * connection = collection -> connection ;
243
243
sword errstatus ;
244
-
244
+
245
245
PHP_OCI_CALL_RETURN (errstatus , OCICollSize , (connection -> env , connection -> err , collection -> collection , (sb4 * )size ));
246
246
247
247
if (errstatus != OCI_SUCCESS ) {
@@ -259,7 +259,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size)
259
259
int php_oci_collection_max (php_oci_collection * collection , zend_long * max )
260
260
{
261
261
php_oci_connection * connection = collection -> connection ;
262
-
262
+
263
263
PHP_OCI_CALL_RETURN (* max , OCICollMax , (connection -> env , collection -> collection ));
264
264
265
265
/* error handling is not necessary here? */
@@ -296,7 +296,7 @@ int php_oci_collection_append_null(php_oci_collection *collection)
296
296
297
297
/* append NULL element */
298
298
PHP_OCI_CALL_RETURN (errstatus , OCICollAppend , (connection -> env , connection -> err , (dvoid * )0 , & null_index , collection -> collection ));
299
-
299
+
300
300
if (errstatus != OCI_SUCCESS ) {
301
301
errstatus = php_oci_error (connection -> err , errstatus );
302
302
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
@@ -341,7 +341,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
341
341
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
342
342
return 1 ;
343
343
}
344
-
344
+
345
345
connection -> errcode = 0 ; /* retain backwards compat with OCI8 1.4 */
346
346
return 0 ;
347
347
}
@@ -358,7 +358,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
358
358
sword errstatus ;
359
359
360
360
element_double = zend_strtod (number , NULL );
361
-
361
+
362
362
PHP_OCI_CALL_RETURN (errstatus , OCINumberFromReal , (connection -> err , & element_double , sizeof (double ), & oci_number ));
363
363
364
364
if (errstatus != OCI_SUCCESS ) {
@@ -396,7 +396,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
396
396
OCIString * ocistr = (OCIString * )0 ;
397
397
php_oci_connection * connection = collection -> connection ;
398
398
sword errstatus ;
399
-
399
+
400
400
PHP_OCI_CALL_RETURN (errstatus , OCIStringAssignText , (connection -> env , connection -> err , (CONST oratext * )element , element_len , & ocistr ));
401
401
402
402
if (errstatus != OCI_SUCCESS ) {
@@ -433,12 +433,12 @@ int php_oci_collection_append(php_oci_collection *collection, char *element, int
433
433
if (element_len == 0 ) {
434
434
return php_oci_collection_append_null (collection );
435
435
}
436
-
436
+
437
437
switch (collection -> element_typecode ) {
438
438
case OCI_TYPECODE_DATE :
439
439
return php_oci_collection_append_date (collection , element , element_len );
440
440
break ;
441
-
441
+
442
442
case OCI_TYPECODE_VARCHAR2 :
443
443
return php_oci_collection_append_string (collection , element , element_len );
444
444
break ;
@@ -478,7 +478,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
478
478
oratext buff [1024 ];
479
479
ub4 buff_len = 1024 ;
480
480
sword errstatus ;
481
-
481
+
482
482
ZVAL_NULL (result_element );
483
483
484
484
connection -> errcode = 0 ; /* retain backwards compat with OCI8 1.4 */
@@ -500,7 +500,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
500
500
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
501
501
return 1 ;
502
502
}
503
-
503
+
504
504
if (exists == 0 ) {
505
505
/* element doesn't exist */
506
506
return 1 ;
@@ -514,7 +514,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
514
514
switch (collection -> element_typecode ) {
515
515
case OCI_TYPECODE_DATE :
516
516
PHP_OCI_CALL_RETURN (errstatus , OCIDateToText , (connection -> err , element , 0 , 0 , 0 , 0 , & buff_len , buff ));
517
-
517
+
518
518
if (errstatus != OCI_SUCCESS ) {
519
519
connection -> errcode = php_oci_error (connection -> err , errstatus );
520
520
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
@@ -523,17 +523,17 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
523
523
524
524
ZVAL_STRINGL (result_element , (char * )buff , buff_len );
525
525
Z_STRVAL_P (result_element )[buff_len ] = '\0' ;
526
-
526
+
527
527
return 0 ;
528
528
break ;
529
529
530
530
case OCI_TYPECODE_VARCHAR2 :
531
531
{
532
532
OCIString * oci_string = * (OCIString * * )element ;
533
533
text * str ;
534
-
534
+
535
535
PHP_OCI_CALL_RETURN (str , OCIStringPtr , (connection -> env , oci_string ));
536
-
536
+
537
537
if (str ) {
538
538
ZVAL_STRING (result_element , (char * )str );
539
539
}
@@ -554,15 +554,15 @@ int php_oci_collection_element_get(php_oci_collection *collection, zend_long ind
554
554
case OCI_TYPECODE_SMALLINT : /* SMALLINT */
555
555
{
556
556
double double_number ;
557
-
557
+
558
558
PHP_OCI_CALL_RETURN (errstatus , OCINumberToReal , (connection -> err , (CONST OCINumber * ) element , (uword ) sizeof (double ), (dvoid * ) & double_number ));
559
559
560
560
if (errstatus != OCI_SUCCESS ) {
561
561
connection -> errcode = php_oci_error (connection -> err , errstatus );
562
562
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
563
563
return 1 ;
564
564
}
565
-
565
+
566
566
ZVAL_DOUBLE (result_element , double_number );
567
567
568
568
return 0 ;
@@ -588,7 +588,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, zend_lon
588
588
589
589
/* set NULL element */
590
590
PHP_OCI_CALL_RETURN (errstatus , OCICollAssignElem , (connection -> env , connection -> err , (ub4 ) index , (dvoid * )"" , & null_index , collection -> collection ));
591
-
591
+
592
592
if (errstatus != OCI_SUCCESS ) {
593
593
connection -> errcode = php_oci_error (connection -> err , errstatus );
594
594
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
@@ -634,7 +634,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, zend_lon
634
634
PHP_OCI_HANDLE_ERROR (connection , connection -> errcode );
635
635
return 1 ;
636
636
}
637
-
637
+
638
638
connection -> errcode = 0 ; /* retain backwards compat with OCI8 1.4 */
639
639
return 0 ;
640
640
}
@@ -651,7 +651,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, zend_l
651
651
sword errstatus ;
652
652
653
653
element_double = zend_strtod (number , NULL );
654
-
654
+
655
655
PHP_OCI_CALL_RETURN (errstatus , OCINumberFromReal , (connection -> err , & element_double , sizeof (double ), & oci_number ));
656
656
657
657
if (errstatus != OCI_SUCCESS ) {
@@ -690,7 +690,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, zend_l
690
690
OCIString * ocistr = (OCIString * )0 ;
691
691
php_oci_connection * connection = collection -> connection ;
692
692
sword errstatus ;
693
-
693
+
694
694
PHP_OCI_CALL_RETURN (errstatus , OCIStringAssignText , (connection -> env , connection -> err , (CONST oratext * )element , element_len , & ocistr ));
695
695
696
696
if (errstatus != OCI_SUCCESS ) {
@@ -728,12 +728,12 @@ int php_oci_collection_element_set(php_oci_collection *collection, zend_long ind
728
728
if (value_len == 0 ) {
729
729
return php_oci_collection_element_set_null (collection , index );
730
730
}
731
-
731
+
732
732
switch (collection -> element_typecode ) {
733
733
case OCI_TYPECODE_DATE :
734
734
return php_oci_collection_element_set_date (collection , index , value , value_len );
735
735
break ;
736
-
736
+
737
737
case OCI_TYPECODE_VARCHAR2 :
738
738
return php_oci_collection_element_set_string (collection , index , value , value_len );
739
739
break ;
@@ -768,7 +768,7 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle
768
768
{
769
769
php_oci_connection * connection = collection_dest -> connection ;
770
770
sword errstatus ;
771
-
771
+
772
772
PHP_OCI_CALL_RETURN (errstatus , OCICollAssign , (connection -> env , connection -> err , collection_from -> collection , collection_dest -> collection ));
773
773
774
774
if (errstatus != OCI_SUCCESS ) {
@@ -798,7 +798,7 @@ void php_oci_collection_close(php_oci_collection *collection)
798
798
connection -> errcode = 0 ; /* retain backwards compat with OCI8 1.4 */
799
799
}
800
800
}
801
-
801
+
802
802
zend_list_delete (collection -> connection -> id );
803
803
efree (collection );
804
804
return ;
0 commit comments