summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benson <dbenson@php.net>2001-09-17 20:52:31 +0000
committerDavid Benson <dbenson@php.net>2001-09-17 20:52:31 +0000
commitd6cecfc2135f0eb8cbc0d8c4fb7b96fdbc5bdd0e (patch)
tree026373a4206ca31a409536001d9c6fb551281157
parent0edb79a3d485ed96b8242f4a2c6a342b5f47f573 (diff)
downloadphp-git-d6cecfc2135f0eb8cbc0d8c4fb7b96fdbc5bdd0e.tar.gz
Change duration of temporary lobs to avoid leakage of temporary lob
space (dbenson).
-rw-r--r--ext/oci8/oci8.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index d92c594307..4a0b5306ee 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -3336,8 +3336,8 @@ PHP_FUNCTION(ociwritetemporarylob)
OCI_DEFAULT,
OCI_DEFAULT,
OCI_TEMP_CLOB,
- TRUE,
- OCI_DURATION_SESSION));
+ OCI_ATTR_NOCACHE,
+ OCI_DURATION_STATEMENT));
if (connection->error) {
oci_error(connection->pError, "OCILobCreateTemporary", connection->error);
@@ -3361,7 +3361,7 @@ PHP_FUNCTION(ociwritetemporarylob)
loblen = (*var)->value.str.len;
if (loblen < 1) {
- php_error(E_WARNING, "Cannot save a lob wich size is less than 1 byte");
+ php_error(E_WARNING, "Cannot save a lob that is less than 1 byte");
RETURN_FALSE;
}
@@ -3400,6 +3400,7 @@ PHP_FUNCTION(ocicloselob)
OCILobLocator *mylob;
oci_connection *connection;
oci_descriptor *descriptor;
+ int is_temporary;
if ((id = getThis()) != 0) {
inx = _oci_get_ocidesc(id,&descriptor TSRMLS_CC);
@@ -3424,6 +3425,26 @@ PHP_FUNCTION(ocicloselob)
RETURN_FALSE;
}
+ connection->error =
+ OCILobIsTemporary(OCI(pEnv),
+ connection->pError,
+ mylob,
+ &is_temporary);
+ if (is_temporary) {
+ connection->error =
+ OCILobFreeTemporary(connection->pServiceContext,
+ connection->pError,
+ mylob);
+
+ if (connection->error) {
+ oci_error(connection->pError, "OCILobFreeTemporary",
+ connection->error);
+ oci_handle_error(connection, connection->error);
+ RETURN_FALSE;
+ }
+ oci_debug("oci_lob_free_temporary: descr=%d",inx);
+ }
+
oci_debug("oci_close_lob: descr=%d",inx);
RETURN_TRUE;
}
@@ -5100,8 +5121,8 @@ PHP_FUNCTION(ocinewcollection)
}
switch(coll->coll_typecode) {
+ case OCI_TYPECODE_TABLE:
case OCI_TYPECODE_VARRAY:
- case OCI_TYPECODE_TABLE:
CALL_OCI_RETURN(connection->error, OCIAttrGet(
(dvoid*) parmp1,
(ub4) OCI_DTYPE_PARAM,