7777%ignore griddb::ContainerInfo::ContainerInfo (GSContainerInfo* containerInfo);
7878%ignore griddb::GSException::get_code;
7979%ignore ColumnInfoList;
80+ %ignore griddb::GSException;
8081
8182/* *
8283 * Support throw exception in PHP language
8384 */
85+ %feature(" except" );
86+
8487%fragment(" throwGSException" , " header" ) {
8588static void throwGSException (griddb::GSException* exception) {
8689 const char * objTypename = " GSException" ;
@@ -98,16 +101,18 @@ static void throwGSException(griddb::GSException* exception) {
98101 objTypenameLen, 0 );
99102 zend_class_entry* ce = zend_lookup_class (objTypenameZend);
100103 zend_string_release (objTypenameZend);
101- if (!ce) {
102- SWIG_FAIL ();
103- }
104104
105105 object_and_properties_init (&ex, ce, NULL );
106106
107107 // Constructor, pass resource to constructor argument
108108 zend_function* constructor = zend_std_get_constructor (Z_OBJ (ex));
109+ %#if PHP_VERSION_ID < 80000
109110 zend_call_method (&ex, ce, &constructor, NULL , 0 , &ctorRv,
110- 1 , &resource, NULL TSRMLS_CC);
111+ 1 , &resource, NULL );
112+ %#else
113+ zend_call_method (Z_OBJ (ex), ce, &constructor, NULL , 0 , &ctorRv,
114+ 1 , &resource, NULL );
115+ %#endif
111116
112117 // Check if no references remaining to ctorRv variable, then destroy it
113118 if (Z_TYPE (ctorRv) != IS_UNDEF) {
@@ -606,7 +611,7 @@ static bool convertDateTimeObjectToGSTimestamp(zval* datetime,
606611 };
607612 call_user_function (EG (function_table), NULL ,
608613 &isAFunctionZval, &isDateTimeZval,
609- ARRAY_SIZE (paramsForIsA), paramsForIsA TSRMLS_CC );
614+ ARRAY_SIZE (paramsForIsA), paramsForIsA);
610615 bool isDateTime = zval_is_true (&isDateTimeZval);
611616 if (!isDateTime) {
612617 return false ;
@@ -622,7 +627,7 @@ static bool convertDateTimeObjectToGSTimestamp(zval* datetime,
622627 call_user_function (EG (function_table), NULL ,
623628 &dateTimestampGetFunctionZval,
624629 &retSecondTimestamp, ARRAY_SIZE (paramsForDateTimestampGet),
625- paramsForDateTimestampGet TSRMLS_CC );
630+ paramsForDateTimestampGet);
626631 int64_t timestampSecond = Z_LVAL (retSecondTimestamp);
627632
628633 // (2)Get timestamp with microsecond
@@ -639,7 +644,7 @@ static bool convertDateTimeObjectToGSTimestamp(zval* datetime,
639644 call_user_function (EG (function_table), NULL ,
640645 &dateFormatFunctionZval,
641646 &retMicrosecondTimestamp, ARRAY_SIZE (paramsForDateFormat),
642- paramsForDateFormat TSRMLS_CC );
647+ paramsForDateFormat);
643648 int64_t timestampMicroSecond = atoi (Z_STRVAL (retMicrosecondTimestamp));
644649
645650 // Convert timestamp to milisecond
@@ -935,7 +940,7 @@ static void convertTimestampToDateTimeObject(GSTimestamp* timestamp,
935940 };
936941
937942 call_user_function (EG (function_table), NULL , &functionNameZval, dateTime,
938- ARRAY_SIZE (params), params TSRMLS_CC );
943+ ARRAY_SIZE (params), params);
939944}
940945}
941946
@@ -978,36 +983,9 @@ static void convertTimestampToDateTimeObject(GSTimestamp* timestamp,
978983 */
979984%fragment(" convertToAgrregationResultZvalObj" , " header" ) {
980985static void convertToAgrregationResultZvalObj (griddb::AggregationResult* aggResult,
981- zval* AggregationResultZvalObject) {
982- const char * objTypename = " AggregationResult" ;
983- size_t objTypenameLen = strlen (objTypename);
984- // Create a resource
985- zval resource;
986-
987- SWIG_SetPointerZval (&resource, reinterpret_cast <void *>(aggResult),
986+ zval* aggregationResultZval) {
987+ SWIG_SetPointerZval (aggregationResultZval, reinterpret_cast <void *>(aggResult),
988988 $descriptor (griddb::AggregationResult *), 1 );
989-
990- // Create a PHP AggregationResult object
991- zend_string * objTypenameZend = zend_string_init (objTypename,
992- objTypenameLen, 0 );
993- zend_class_entry* ce = zend_lookup_class (objTypenameZend);
994- zend_string_release (objTypenameZend);
995- if (!ce) {
996- SWIG_FAIL ();
997- }
998-
999- object_and_properties_init (AggregationResultZvalObject, ce, NULL );
1000-
1001- // Constructor, pass resource to constructor argument
1002- zval ctorRv;
1003- zend_function* constructor = zend_std_get_constructor (Z_OBJ (*AggregationResultZvalObject));
1004- zend_call_method (AggregationResultZvalObject, ce, &constructor, NULL ,
1005- 0 , &ctorRv, 1 , &resource, NULL TSRMLS_CC);
1006-
1007- // Check if no references remaining to ctorRv variable, then destroy it
1008- if (Z_TYPE (ctorRv) != IS_UNDEF) {
1009- zval_ptr_dtor (&ctorRv);
1010- }
1011989}
1012990}
1013991
0 commit comments