RFC: ext/interbase/ibase_query.c (PHP_5_3)

php.internals

Lars Westermann

18 years ago
Hi! Request For Comments for bugfixes made to ext/interbase/ibase_query.c. I'm working on the PHP_5_3 branch. I've been working on bugfixes for the following bugreports: #30690, InterBase: Resource handle from ibase_execute becomes invalid after return #32143, ibase_query() causes IB server crash with invalid DB and parameters #39397, invalid statement handle in Unknown on line 0 #39700, NUMERIC error when result precision are 7,8 or 12-14 #32143 is solved by checking for an empty querystring - if that's the case, an error is returned, and no attempt to prepare a query is made. #39700 is also quite easy to solve (solutions presented in comment section of bugreport) #30690 and #39397 are somewhat related as they both address problems with destruction of query and result resources. My bugfix for this is based on the fact, that there is a one-to-one relationship between a query resource and a result resource. Both resources share a common statement handle to the Interbase/Firebird API, and the idea behind the solution is to only drop this statement handle, when neither the query resource nor the result resource need it. I have therefore bound the two resources together with a pointer in each structure pointing at each other. These pointers are assigned a value when a result resource is created. Upon destruction of either, the pointer in the opposite structure is NULL'ed, indicating that this resource no longer exists. When the last of the two resources is destroyed, the pointer to the other resource is NULL, and then it is time to drop the statement handle in the API. In addition, before the statement handle is dropped, it is checked, that the database link is still valid (to prevent a Warning when destroying a query resource after the database link is closed). I have attached a unified diff for the changes made. I would appreciate any comments to the solutions chosen/made. Best regards Lars W

Lester Caine

18 years ago
Lars I have still not managed a successful build of this module on the 64 bit platforms :( I'm going to take a clean download of the 5.2.5RC later and start again from scratch building the whole thing to see what happens, but I'm still fire fighting a couple of new installations. One ran clean yesterday - for the first time - after killing sophos on the client display machines. The Apache/PHP side is running fine after bypassing the interbase.so Blob Bug :)
-- Lester Caine - G8HFL ----------------------------- Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://home.lsces.co.uk MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/ Firebird - http://www.firebirdsql.org/index.php