note 108482 deleted from pdo.quote by aharvey
| From: | aharvey@php.net | Date: | Wed, 26 Sep 2012 00:40:48 +0000 |
| Subject: | note 108482 deleted from pdo.quote by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191025@lists.php.net to get a copy of this message | ||
Note Submitter: orrd101 at gmail dot com
----
Despite the recommendation above that you are "strongly recommended" to use
PDO::prepare(), using PDO::quote() with PDO::query() is significantly faster than using prepared
statements (unless you're submitting many identical queries in a sequence). Test data from
several sources shows about a 2-3x speed penalty for using prepared queries if you are only
submitting a single query, and prepared queries only have a speed advantage when you are submitting
thousands of queries from prepared statement at once.
It's also more convenient since less lines of code are required and you don't have to deal
with the challenge of keeping all your ?'s properly ordered to match a separate parameter list
as you do with prepared statements.
So don't let the wording of the description scare you away from using this method.