Hi,

1. Automatic cleanup is something that we could add to PDO, at least
for MySQL. I am not sure if other drivers have reset methods. The
cleanup should probably happen when requesting the connection again.

But there is a reason why mysqli allows for this feature to be
switched off in the compilation options. Certain users do not like
this. It is silently discarding errors and data, which could be
disastrous in some situations. If such a feature is added to PDO, it
should be opt-in, so that users aren't automatically enrolled in a
dangerous feature.

2. A reset method sounds really reasonable, even if it is only a
driver-specific method for MySQL. It should probably use
mysql_reset_connection(). If this method is added, then we don't need
to bother adding automatic cleanup, as this would be a far better
option.

> PDO does not have method for closing connection.

As I said in an earlier email, this is intentional. Such a method is a bad idea.

> But in event loops this may be complicated because of internal references to 
> PDO object from PDOStatement objects

And that's very good. As long as any PDOStatement or PDO objects refer
to the connection, it should NOT be closed. Giving users such an
option would only result in creating crippled objects for no apparent
benefit. I stand by what I said before: in a well-designed
application, there is absolutely no reason to close the connection
explicitly.

Regards,
Kamil

Reply via email to