Home > Archive > PHP Pear > November 2004 > PEAR::DB - DB::connect inconsistency using mysql?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PEAR::DB - DB::connect inconsistency using mysql?
|
|
| Luis Correa D'Almeida 2004-11-26, 9:02 am |
| Hi,
It seems the DB::connect() method returns a new instance of DB_mysql,
but keeps the same connection if the DSN is the same (looking at the
method and according to PHP's documentation of mysql_connect). This
reveals an inconsistency at the PEAR level, given that you now get a new
instance, but with an existing connection. One would think that getting
a new object would mean getting a new connection. This is a problem when
dealing with transactions: the state of the connection in the object is
lost; there is no reference to whether we are in the middle of a
transaction. Furthermore, an open transaction can be committed using the
new object, but an existing connection!
Is there a reason for such behavior?
Thanks,
Luis
| |
| Lukas Smith 2004-11-26, 9:02 am |
| Luis Correa D'Almeida wrote:
> Hi,
>
>
>
> It seems the DB::connect() method returns a new instance of DB_mysql,
> but keeps the same connection if the DSN is the same (looking at the
> method and according to PHP's documentation of mysql_connect). This
> reveals an inconsistency at the PEAR level, given that you now get a new
> instance, but with an existing connection. One would think that getting
> a new object would mean getting a new connection. This is a problem when
> dealing with transactions: the state of the connection in the object is
> lost; there is no reference to whether we are in the middle of a
> transaction. Furthermore, an open transaction can be committed using the
> new object, but an existing connection!
this is a problem inside the mysql extension .. there is nothing
PEAR::DB can do against this.
regards,
Lukas
|
|
|
|
|