PDO questions

From: Date: Thu, 22 Sep 2005 10:53:46 +0000
Subject: PDO questions
Groups: php.internals 
Request: Send a blank email to internals+get-19116@lists.php.net to get a copy of this message
After reading the php|architect article on PDO by Ilia I have a couple of questions: 1) Does unsetting $stmt trigger a closeCursor() as well? I assume so, but the article doesn't mention it. It only talks about the importance of calling that method. 2) Could it be a good idea (performance wise) and possible in the first place to maintain a pool of prepared statements? Something like this: class MyClass { private $stmts = array(); public function __construct($db) { $this->db = $db; } public function getInfo() { if (!isset($this->stmts["info"])) $this->stmts["info"] = $this->db->prepare("select ........."); $this->stmts["info"]->execute(array("foo", "bar")); ... } } 3) Wouldn't it be nice if you could do a $stmt->execute("foo", "bar"); (numeric parameters) instead of $stmt->execute(array("foo", "bar")); ? Nice article by the way, Ilia, although I think the php|arch editor(s) really could do a better job. I wrote an article for them myself on SOAP a while ago, and I can't say I was too satisfied on the job the editor did on it. Ron

« previous php.internals (#19116) next »