41
41
#endif
42
42
43
43
#define Z_OCILOB_DESCRIPTOR_P (zv ) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
44
+ #define Z_OCICOLLECTION_COLLECTION_P (zv ) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
44
45
45
46
#define ERROR_ARG_POS (arg_num ) (getThis() ? (arg_num-1) : (arg_num))
46
47
@@ -2014,11 +2015,7 @@ PHP_FUNCTION(oci_free_collection)
2014
2015
RETURN_THROWS ();
2015
2016
}
2016
2017
2017
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_collection ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2018
- php_error_docref (NULL , E_WARNING , "Unable to find collection property" );
2019
- RETURN_FALSE ;
2020
- }
2021
-
2018
+ tmp = Z_OCICOLLECTION_COLLECTION_P (z_collection );
2022
2019
PHP_OCI_ZVAL_TO_COLLECTION (tmp , collection );
2023
2020
2024
2021
zend_list_close (collection -> id );
@@ -2038,11 +2035,7 @@ PHP_FUNCTION(oci_collection_append)
2038
2035
RETURN_THROWS ();
2039
2036
}
2040
2037
2041
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_collection ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2042
- php_error_docref (NULL , E_WARNING , "Unable to find collection property" );
2043
- RETURN_FALSE ;
2044
- }
2045
-
2038
+ tmp = Z_OCICOLLECTION_COLLECTION_P (z_collection );
2046
2039
PHP_OCI_ZVAL_TO_COLLECTION (tmp , collection );
2047
2040
2048
2041
if (php_oci_collection_append (collection , value , (int ) value_len )) {
@@ -2063,11 +2056,7 @@ PHP_FUNCTION(oci_collection_element_get)
2063
2056
RETURN_THROWS ();
2064
2057
}
2065
2058
2066
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_collection ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2067
- php_error_docref (NULL , E_WARNING , "Unable to find collection property" );
2068
- RETURN_FALSE ;
2069
- }
2070
-
2059
+ tmp = Z_OCICOLLECTION_COLLECTION_P (z_collection );
2071
2060
PHP_OCI_ZVAL_TO_COLLECTION (tmp , collection );
2072
2061
2073
2062
if (php_oci_collection_element_get (collection , element_index , return_value )) {
@@ -2086,16 +2075,8 @@ PHP_FUNCTION(oci_collection_assign)
2086
2075
RETURN_THROWS ();
2087
2076
}
2088
2077
2089
- if ((tmp_dest = zend_hash_str_find (Z_OBJPROP_P (z_collection_dest ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2090
- php_error_docref (NULL , E_WARNING , "Unable to find collection property. The first argument should be valid collection object" );
2091
- RETURN_FALSE ;
2092
- }
2093
-
2094
- if ((tmp_from = zend_hash_str_find (Z_OBJPROP_P (z_collection_from ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2095
- php_error_docref (NULL , E_WARNING , "Unable to find collection property. The second argument should be valid collection object" );
2096
- RETURN_FALSE ;
2097
- }
2098
-
2078
+ tmp_dest = Z_OCICOLLECTION_COLLECTION_P (z_collection_dest );
2079
+ tmp_from = Z_OCICOLLECTION_COLLECTION_P (z_collection_from );
2099
2080
PHP_OCI_ZVAL_TO_COLLECTION (tmp_dest , collection_dest );
2100
2081
PHP_OCI_ZVAL_TO_COLLECTION (tmp_from , collection_from );
2101
2082
@@ -2119,11 +2100,7 @@ PHP_FUNCTION(oci_collection_element_assign)
2119
2100
RETURN_THROWS ();
2120
2101
}
2121
2102
2122
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_collection ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2123
- php_error_docref (NULL , E_WARNING , "Unable to find collection property" );
2124
- RETURN_FALSE ;
2125
- }
2126
-
2103
+ tmp = Z_OCICOLLECTION_COLLECTION_P (z_collection );
2127
2104
PHP_OCI_ZVAL_TO_COLLECTION (tmp , collection );
2128
2105
2129
2106
if (php_oci_collection_element_set (collection , element_index , value , (int ) value_len )) {
@@ -2144,11 +2121,7 @@ PHP_FUNCTION(oci_collection_size)
2144
2121
RETURN_THROWS ();
2145
2122
}
2146
2123
2147
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_collection ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2148
- php_error_docref (NULL , E_WARNING , "Unable to find collection property" );
2149
- RETURN_FALSE ;
2150
- }
2151
-
2124
+ tmp = Z_OCICOLLECTION_COLLECTION_P (z_collection );
2152
2125
PHP_OCI_ZVAL_TO_COLLECTION (tmp , collection );
2153
2126
2154
2127
if (php_oci_collection_size (collection , & size )) {
@@ -2169,11 +2142,7 @@ PHP_FUNCTION(oci_collection_max)
2169
2142
RETURN_THROWS ();
2170
2143
}
2171
2144
2172
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_collection ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2173
- php_error_docref (NULL , E_WARNING , "Unable to find collection property" );
2174
- RETURN_FALSE ;
2175
- }
2176
-
2145
+ tmp = Z_OCICOLLECTION_COLLECTION_P (z_collection );
2177
2146
PHP_OCI_ZVAL_TO_COLLECTION (tmp , collection );
2178
2147
2179
2148
if (php_oci_collection_max (collection , & max )) {
@@ -2194,11 +2163,7 @@ PHP_FUNCTION(oci_collection_trim)
2194
2163
RETURN_THROWS ();
2195
2164
}
2196
2165
2197
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_collection ), "collection" , sizeof ("collection" )- 1 )) == NULL ) {
2198
- php_error_docref (NULL , E_WARNING , "Unable to find collection property" );
2199
- RETURN_FALSE ;
2200
- }
2201
-
2166
+ tmp = Z_OCICOLLECTION_COLLECTION_P (z_collection );
2202
2167
PHP_OCI_ZVAL_TO_COLLECTION (tmp , collection );
2203
2168
2204
2169
if (php_oci_collection_trim (collection , trim_size )) {
@@ -2225,7 +2190,7 @@ PHP_FUNCTION(oci_new_collection)
2225
2190
2226
2191
if ( (collection = php_oci_collection_create (connection , tdo , (int ) tdo_len , schema , (int ) schema_len )) ) {
2227
2192
object_init_ex (return_value , oci_coll_class_entry_ptr );
2228
- add_property_resource ( return_value , "collection" , collection -> id );
2193
+ ZVAL_RES ( Z_OCICOLLECTION_COLLECTION_P ( return_value ) , collection -> id );
2229
2194
}
2230
2195
else {
2231
2196
RETURN_FALSE ;
0 commit comments