PEAR oci8 interface problem
| From: | Dave Sugar | Date: | Fri, 27 Sep 2002 19:07:57 +0000 |
| Subject: | PEAR oci8 interface problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2397@lists.php.net to get a copy of this message | ||
We are finishing up a large website using the PEAR DB interface for all of
our database interaction. We are now into heavy duty testing and have found
what I believe is a problem in the oci8.php Oracle interface.
Here is what I found - maybe we are using the interface incorrectly, but
from what I can tell it is a problem.
There is a case at our website where a user can upload a comma delimited
file which contains a list of additional user accounts to create. Each user
account is a single row in a database, requiring an single SQL insert to
create each one. So this code is executing in a loop.
I noticed that in oci8.php in the functions 'simpleQuery' and 'execute'
the result from OCIParse (the query) is assigned to $this->last_stmt. But
freeResult is NEVER called so OCIFreeStatement is never called. This is OK
when calling select statements (which use prepare/execute) because they are
returned in DB_Results which has a 'free' function. But for inserts and
updates this is a problem.
If doing enough insert or updates eventually you will get an error in
oracle about 'Too many open cursors'. I was able to fix the problem by
writing my own version of the functions simpleQuery and execute which call
'freeResult' if the query matches DB::isManip.
I know the change we made will break the functions numRows, errorNative
and affectedRows, but we are not using these functions so it is OK for us.
I tried to work on a change to correct oci8.php, but it didn't seem to be
working correctly and I don't have enough insight into the design of the
oci8.php interface to know what else I might be breaking.
In general this isn't a problem because when a page is finished all
resources are freed (including open cursors), but when running in a loop it
is definitely a problem.
I have installed PHP 4.2.3 and here is the ID from oci8.php // $Id:
oci8.php,v 1.47.2.1 2002/04/09 19:04:15 ssb Exp $
Thanks for any help
Dave Sugar
dsugar@dolphinsoft.com