note 124787 deleted from pdo.connections by salathe

From: Date: Mon, 21 Sep 2020 14:55:14 +0000
Subject: note 124787 deleted from pdo.connections by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215375@lists.php.net to get a copy of this message
Note Submitter: antony at harrisretail dot co dot uk ---- 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

« previous php.notes (#215375) next »