From: Andy Sautins Date: Tue, 22 May 2001 23:16:03 +0000 (+0000) Subject: - Add correct OCIObjectFree to free collections immediately ( OCI_FREECOLLECTION_F... X-Git-Tag: PRE_GRANULAR_GARBAGE_FIX~277 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=915875a6670c83770d10ead1a19ac57224796d5f;p=php - Add correct OCIObjectFree to free collections immediately ( OCI_FREECOLLECTION_FORCE ) - Added schema optional parameter to OCINewCollection to allow accessing types in other schemas. - Added OCI_TYPECODE_TABLE to OCINewCollection to allow creation of collection of TYPES as well as VARRAYS --- diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index dc1558cb47..7c3599806e 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -4305,6 +4305,15 @@ PHP_FUNCTION(ocifreecoll) */ connection = coll->conn; oci_debug("OCIfreecoll: coll=%d",inx); + connection->error = OCIObjectFree(OCI(pEnv), + connection->pError, + (dvoid *)coll->coll, + (ub2)(OCI_OBJECTFREE_FORCE)); + if (connection->error) { + oci_error(connection->pError, "OCIObjectFree", connection->error); + RETURN_FALSE; + } + zend_list_delete(inx); RETURN_TRUE; } @@ -4747,7 +4756,7 @@ PHP_FUNCTION(ocicolltrim) } /* }}} */ -/* {{{ proto string ocinewcollection(int connection, string tdo) +/* {{{ proto string ocinewcollection(int connection, string tdo,[string schema]) Initialize a new collection */ PHP_FUNCTION(ocinewcollection) @@ -4755,17 +4764,25 @@ PHP_FUNCTION(ocinewcollection) dvoid *dschp1; dvoid *parmp1; dvoid *parmp2; - zval **conn, **tdo; + zval **conn, **tdo, **schema; oci_connection *connection; oci_collection *coll; + int ac = ZEND_NUM_ARGS(); OCILS_FETCH(); - if (zend_get_parameters_ex(2, &conn, &tdo) != SUCCESS) { + + + if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &conn, &tdo, &schema) == FAILURE) { WRONG_PARAM_COUNT; } + convert_to_string_ex(tdo); + if(ac == 3) { + convert_to_string_ex(schema); + } + coll = emalloc(sizeof(oci_collection)); OCI_GET_CONN(connection,conn); @@ -4777,8 +4794,8 @@ PHP_FUNCTION(ocinewcollection) connection->error = OCITypeByName(OCI(pEnv), connection->pError, connection->pServiceContext, - (text *) 0, - (ub4) 0, + ac==3?(text *)(*schema)->value.str.val:(text *)0, + ac==3?(ub4)(*schema)->value.str.len: (ub4)0, (text *) (*tdo)->value.str.val, (ub4) (*tdo)->value.str.len, (CONST text *) 0, (ub4) 0, @@ -4826,6 +4843,7 @@ PHP_FUNCTION(ocinewcollection) switch(coll->coll_typecode) { case OCI_TYPECODE_VARRAY: + case OCI_TYPECODE_TABLE: connection->error = OCIAttrGet((dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, (dvoid*) &parmp2, (ub4 *) 0,