RE: [PHP-DEV] [PATCH] Generate warning when using PDO::setAttribute() and ATTR_PERSISTENT

From: Date: Fri, 26 Oct 2007 18:44:31 +0000
Subject: RE: [PHP-DEV] [PATCH] Generate warning when using PDO::setAttribute() and ATTR_PERSISTENT
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-32983@lists.php.net to get a copy of this message
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_PERSISTENT > > 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/

« previous php.internals (#32983) next »