Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22599 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83389 invoked by uid 1010); 27 Mar 2006 16:35:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83373 invoked from network); 27 Mar 2006 16:35:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2006 16:35:49 -0000 X-Host-Fingerprint: 219.166.150.11 mx1.es-i.jp Linux 2.4 w/o timestamps Received: from ([219.166.150.11:46932] helo=mx1.es-i.jp) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E1/34-37235-46418244 for ; Mon, 27 Mar 2006 11:35:48 -0500 Received: (qmail 25719 invoked by uid 501); 27 Mar 2006 16:35:44 -0000 Received: from yohgaki@ohgaki.net by mx1.es-i.jp by uid 401 with qmail-scanner-1.20 (clamscan: 0.65. spamassassin: 2.60. Clear:RC:1(192.168.100.210):. Processed in 0.014787 secs); 27 Mar 2006 16:35:44 -0000 X-Qmail-Scanner-Mail-From: yohgaki@ohgaki.net via mx1.es-i.jp X-Qmail-Scanner: 1.20 (Clear:RC:1(192.168.100.210):. Processed in 0.014787 secs) Received: from unknown (HELO ?127.0.0.1?) (192.168.100.210) by mx1.es-i.jp with SMTP; 27 Mar 2006 16:35:44 -0000 Message-ID: <442814D1.2040206@ohgaki.net> Date: Tue, 28 Mar 2006 01:37:37 +0900 User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: internals@lists.php.net References: <4425040E.60402@ohgaki.net> <44250532.7070509@php.net> <44275330.7050508@ohgaki.net> <44279BCB.1090105@php.net> <44280F96.3090600@ohgaki.net> In-Reply-To: <44280F96.3090600@ohgaki.net> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: pg_execute error From: yohgaki@ohgaki.net (Yasuo Ohgaki) Yasuo Ohgaki wrote: > Lukas Smith wrote: >> 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. > > This issue is like file_exists() raises E_ERROR, since > PostgreSQL does not provide means to check if plan is > already defined. i.e. design error for the function. > > Even if PostgreSQL provide view for already defined plans, > selecting the view to check requires. It requires overheads > which requires network traffic. Thus adding new feature to > check if plan is defined is not good idea. > i.e. DB is usually a bottle neck of web systems. > To make this issue clear, consider following code for ($i = 0; $i < 10000; $i++) { if (!pg_is_prepared('myplan')) { // suppose this function is there pg_prepare('myplan', 'sql'); } pg_execute('myplan', $values); } w/o the patch, pg_is_prepared() has to be called 10k times which probably requires additional network traffic. Best practice tells users should prepare statement before get into transaction block and check transaction is committed or aborted anyway. There are other reasons that transaction may fail as you probably knew. I disabled all E_WARNING, since all users are encouraged to check the return status of pg_execute(), but other error may be caught by pg_execute(). Is this enough? -- Yasuo Ohgaki : yohgaki@ohgaki.net : http://www.ohgaki.net/