For a while, we were scratching our heads over why persistent
connections were not being created when using PDO_OCI, even though we
were explicitly calling PDO::setAttribute() to set PDO::ATTR_PERSISTENT.
My colleague Brian DeShong further explains the issue on his blog:
http://www.deshong.net/?p=61
"You must set PDO::ATTR_PERSISTENT => true in the array of options you
pass to the PDO constructor! If you call
$pdo->setAttribute(PDO::ATTR_PERSISTENT, true) after the instantiation
of the object, you won’t be using persistent connections."
He goes on to say: "It’d be nice if PDO::setAttribute() raised a warning
if you try to set PDO::ATTR_PERSISTENT, by the way."
I'm submitting the attached patch to do just that. :-)
--
Ben Ramsey
http://benramsey.com/
Why is it not an if() statement?
-----Original Message-----
From: Ben Ramsey [mailto:ramsey@php.net]
Sent: Friday, October 26, 2007 10:38 AM
To: internals@lists.php.net
Subject: [PHP-DEV] [PATCH] Generate warning when using
PDO::setAttribute() and ATTR_PERSISTENTFor a while, we were scratching our heads over why persistent
connections were not being created when using PDO_OCI, even though we
were explicitly calling PDO::setAttribute() to set
PDO::ATTR_PERSISTENT.My colleague Brian DeShong further explains the issue on his blog:
http://www.deshong.net/?p=61"You must set PDO::ATTR_PERSISTENT => true in the array of options you
pass to the PDO constructor! If you call $pdo-setAttribute(PDO::ATTR_PERSISTENT, true) after the instantiation of
the object, you won’t be using persistent connections."He goes on to say: "It’d be nice if PDO::setAttribute() raised a
warning if you try to set PDO::ATTR_PERSISTENT, by the way."I'm submitting the attached patch to do just that. :-)
--
Ben Ramsey
http://benramsey.com/
Why is it not an if() statement?
It can be an if() statement. I added it as a switch in the expectation
that other attributes might be added to it in the future.
--
Ben Ramsey
http://benramsey.com/
Why is it not an if() statement?
-----Original Message-----
From: Ben Ramsey [mailto:ramsey@php.net]
Sent: Friday, October 26, 2007 10:38 AM
To: internals@lists.php.net
Subject: [PHP-DEV] [PATCH] Generate warning when using
PDO::setAttribute() and ATTR_PERSISTENTFor a while, we were scratching our heads over why persistent
connections were not being created when using PDO_OCI, even though we
were explicitly calling PDO::setAttribute() to set
PDO::ATTR_PERSISTENT.My colleague Brian DeShong further explains the issue on his blog:
http://www.deshong.net/?p=61"You must set PDO::ATTR_PERSISTENT => true in the array of options
you
pass to the PDO constructor! If you call $pdo-setAttribute(PDO::ATTR_PERSISTENT, true) after the instantiation of
the object, you won’t be using persistent connections."He goes on to say: "It’d be nice if PDO::setAttribute() raised a
warning if you try to set PDO::ATTR_PERSISTENT, by the way."I'm submitting the attached patch to do just that. :-)
Personally I find the entire attribute stuff in PDO a gigantic mess
which I said before the first release. Some things are not attributes
you can set, some of the things you cannot set at runtime etc. So
something are "attributes" of the connections, others are options and
yet others can only be set at connect time, so they should not even
be accepted as valid parameters to whatever set*() method as you
point out as it will have no effect. This should really be cleaned up
one day (PDO2?)
regards,
Lukas