[Patch] DB_common dealing with prepared statements
| From: | Michael Moen | Date: | Sun, 21 Dec 2003 03:13:32 +0000 |
| Subject: | [Patch] DB_common dealing with prepared statements | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-24587@lists.php.net to get a copy of this message | ||
I noticed that there wasn't any checking taking place during prepare(), this patch checks the previously prepared statements (if any) and does not bother to prepare a duplicate statement by checking prepared_queries for the current query being prepared.
This may not be a huge issue for most, but here is where I noticed it:
I have an object (AudioCD) that contains a reference to a DB object. The AudioCD has a method, getTracks() that executes some SQL to get a list of tracks and then instantiates a new Track object for each one, passing in a reference to the DB object and the primary key of the object to create. After instantiating all of the tracks for a given CD I noticed that prepare_tokens had many duplicate entries, due to the SQL being prepared for each Track all on the same DB object.
Michael