note 124787 added to pdo.connections
| From: | antony at harrisretail dot co dot uk | Date: | Tue, 03 Mar 2020 15:56:58 +0000 |
| Subject: | note 124787 added to pdo.connections | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214275@lists.php.net to get a copy of this message | ||
It's not possible to use a persistent connection and to extend the PDOStatement class to add
methods to the standard class. This means that you cannot do:
<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass,
array(PDO::ATTR_PERSISTENT => true));
$dbh->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('MyPDOStatement', array($this)));
?>
This results in an error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General
error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.195 (proxied: 2a00:23c4:992:dd01:48b8:c79e:c995:abf5)
----
Manual Page -- http://php.net/manual/en/pdo.connections.php
Edit -- https://master.php.net/note/edit/124787
Del: integrated -- https://master.php.net/note/delete/124787/integrated
Del: useless -- https://master.php.net/note/delete/124787/useless
Del: bad code -- https://master.php.net/note/delete/124787/bad+code
Del: spam -- https://master.php.net/note/delete/124787/spam
Del: non-english -- https://master.php.net/note/delete/124787/non-english
Del: in docs -- https://master.php.net/note/delete/124787/in+docs
Del: other reasons-- https://master.php.net/note/delete/124787
Reject -- https://master.php.net/note/reject/124787
Search -- https://master.php.net/manage/user-notes.php