]> granicus.if.org Git - php/commitdiff
enable statement cache for non-persistent connections (patch by Chris Jones)
authorAntony Dovgal <tony2001@php.net>
Fri, 8 Jun 2007 08:44:26 +0000 (08:44 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 8 Jun 2007 08:44:26 +0000 (08:44 +0000)
ext/oci8/oci8.c
ext/oci8/oci8_statement.c

index 375511c080af211ee1a454cf99ad7087f06933c7..8f45f9153b755b0f265b0acad4ef5e6e75d2632f 100644 (file)
@@ -1417,7 +1417,7 @@ open:
        }
 
 #if HAVE_OCI_STMT_PREPARE2
-       if (connection->is_persistent) {
+       {
                ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0;
 
                PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err)));
index 6069a277f0220d5d07a17d827676c59103d2f799..1cc811362f967f3221a00ce9bc2a36d2d6a80ac1 100644 (file)
@@ -82,7 +82,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst
                        php_oci_error(connection->err, connection->errcode TSRMLS_CC);
 
 #if HAVE_OCI_STMT_PREPARE2
-                       PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_DEFAULT));
+                       PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
                        PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR));
 #else
                        PHP_OCI_CALL(OCIHandleFree,(statement->stmt, OCI_HTYPE_STMT));
@@ -746,7 +746,7 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC)
        if (statement->stmt) {
 #if HAVE_OCI_STMT_PREPARE2
                if (statement->last_query_len) { /* FIXME: magical */
-                       PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_DEFAULT));
+                       PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
                } else {
                        PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT));
                }