Re: Re: [binarycloud-dev] FW: lets talk "metapear" - politics aside:-)
| From: | John Lim | Date: | Tue, 19 Mar 2002 17:40:29 +0000 |
| Subject: | Re: Re: [binarycloud-dev] FW: lets talk "metapear" - politics aside:-) | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5044@lists.php.net to get a copy of this message | ||
> Could someone explain to me the real advantage behind prepare?
> I think I know part of it but could someone just give me an entire run
> down? :-)
>
> Lukas Smith
> smith@dybnet.de
Hi Lukas,
Prepare() parses and compiles your sql once. So if you have an insert
statement
that is suppose to be run 1000 times in a loop, imagine saving the compile
time
by doing a Prepare() once only. It's a bit like using Zend Cache or APC for
SQL.
The other advantage is that you don't need to quote your strings yourself,
avoiding any security problems from tainted data (eg. $_GET and $_POST
strings).
Regards, John