Re: pdo prepare()
| From: | Dan Scott | Date: | Fri, 30 Sep 2005 14:47:39 +0000 |
| Subject: | Re: pdo prepare() | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-3029@lists.php.net to get a copy of this message | ||
On 9/30/05, Lukas Smith <lsmith@php.net> wrote:
> Hi,
>
> It seems to me like prepare() does not actually prepare the query in the
> database? Instead it seems to wait until I do the first execute()? This
> seems to delay the actual error in a slightly confusing way imho.
<snip>
Hi Lukas:
It's quite common for database drivers to use a deferred prepare()
call to avoid extra trips to the database server. In DB2, for example,
deferred prepare() is used by default:
http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/ad/r0000635.htm
You can normally override that behaviour; for example the ODBC
specification offers the SQL_ATTR_DEFERRED_PREPARE statement attribute
-- but for performance reasons deferred prepare() is the recommended
default.
Dan
Dan