Re: [PHP4BETA] cvs: /php4/ext/odbc php_odbc.h php_odbc.c
| From: | Andreas Karajannis | Date: | Sun, 12 Mar 2000 18:02:54 +0000 |
| Subject: | Re: [PHP4BETA] cvs: /php4/ext/odbc php_odbc.h php_odbc.c | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11957@lists.php.net to get a copy of this message | ||
Leo Baschy wrote:
> Therefore I ask: What was your problem with my code that freed results when connections got
> closed? Sure, it was not ideal because it freed only one result, but how do you get more than one
> anyway...
You can have more than one result on a connection. Take a look at the
php3/tests/odbc-t4.php3.
The problem with your code was that it was unnecessary.
> The close connection with a result still around can happen easily. To be disciplined is good,
> but it is unnecessary hard on people and creates unnecessary instability.
>
> If result/connection cleanup were handled via Zend's reference mechanism that would be
> nice, but it doesn't work correctly right now. It would take me a while to fully understand
> that part. I can do so, have understood more complex things, but it is a question of time. Just
> spent too much time with sources of PHP3, only started working with PHP4 recently.
>
> Do you want yourself to look into why it doesn't work, or do you want to give me a hint
> where to look, etc?
Explicit closing of a connection doesn't free associated results,
therefore leading to crashes.
But with Zend's reference mechanism exists a very simple way to have
connections and results destroyed in the right order automatically on
request shutdown. Normally, the user doesn't need to bother with closing
connections and freeing results, since these things are handled during
request shutdown. Not closing a connection explicitly should also speed
up page generation, since all these things happen after the page has
been sent to the client.
I will add something similar to your code snippet to odbc_close(), so
that explicitly closing a connection won't crash anymore.
-Andreas