- 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
This commit is contained in:
Andy Sautins 2001-05-22 23:16:03 +00:00
parent f0b6b8ab52
commit 915875a667

View File

@ -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,