[PATCH] Generate warning when using PDO::setAttribute() and ATTR_PERSISTENT
| From: | Ben Ramsey | Date: | Fri, 26 Oct 2007 17:38:04 +0000 |
| Subject: | [PATCH] Generate warning when using PDO::setAttribute() and ATTR_PERSISTENT | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-32982@lists.php.net to get a copy of this message | ||
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/