Re: pg_execute error
| From: | Lukas Smith | Date: | Mon, 27 Mar 2006 08:01:15 +0000 |
| Subject: | Re: pg_execute error | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-22591@lists.php.net to get a copy of this message | ||
Yasuo Ohgaki wrote:
> Lukas Smith wrote:
>> Yasuo Ohgaki wrote:
>>
>>> 3) add bool parameter to pg_execute()
>>> e.g. pg_execute(resource connection, string stmtname, array params, bool
>>> ignore_error)
>> how would you intent to implement this?
>> AFAIK there is currently no catalog to find out the prepared statements
>> in the current sessions (I hear 8.2 will change this). So the only way
>> to find out is to simply "try it" and cause an error in the session
>> which could trigger all sorts of error handlers on the database side ..
>> something I would not expect from calling a php function like this.
>
> I hear about that.
>
> Current pg_execute raise E_WARNING if plan is not prepared.
> The error is annoying since programmers has to try and
> see if it works.
>
> Anyway, since there are no other comments, I'll get rid of
> the error from pg_execute. Since this is the most efficient
> way.
Just to make it clear: calling pg_execute() on a not yet prepared
statement will cause your transaction to be rolled back on the next
commit. Encouraging the use of pg_execute() to find out of the statement
has been prepared is therefore wrong.
Moreover by your logic we would need to remove E_WARNING's from php
entirely. Finally you can detect if a function call was called with
error suppression in your error handler and that is the appropriate
place to address your issue.
regards,
Lukas