Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15550 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22263 invoked by uid 1010); 23 Mar 2005 03:31:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 22244 invoked from network); 23 Mar 2005 03:31:58 -0000 Received: from unknown (HELO familyhealth.com.au) (127.0.0.1) by localhost with SMTP; 23 Mar 2005 03:31:58 -0000 X-Host-Fingerprint: 203.22.197.21 houston.au.fhnetwork.com FreeBSD 4.6-4.9 Received: from ([203.22.197.21:4337] helo=houston.familyhealth.com.au) by pb1.pair.com (ecelerity HEAD r(5268)) with SMTP id E2/B0-04146-D23E0424 for ; Tue, 22 Mar 2005 22:31:58 -0500 Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 9B75F24FE1; Wed, 23 Mar 2005 11:31:54 +0800 (WST) Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 924C124FE0; Wed, 23 Mar 2005 11:31:54 +0800 (WST) Message-ID: <4240E38E.6060504@familyhealth.com.au> Date: Wed, 23 Mar 2005 11:33:34 +0800 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Wez Furlong Cc: Dan Scott , php-dev References: <423F84AD.9070809@familyhealth.com.au> <027201c52ed8$8b369170$1200000a@intra.emini.dk> <42402D82.8000305@familyhealth.com.au> <4240BFD5.9090605@familyhealth.com.au> <4e89b42605032219241edf4a16@mail.gmail.com> In-Reply-To: <4e89b42605032219241edf4a16@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] pdo_pgsql From: chriskl@familyhealth.com.au (Christopher Kings-Lynne) > Depends on how you define "correctly" ;-) > Chances are that it will raise an error. > > I'm not sure if this should really be considered a problem; that's a > really obtuse SQL statement. As a non-pgsqler, I have a hard time > figuring out where the variables are. Well, anything that's not perfect is a problem :) Dollar quoting is new in pgsql 8, it's sort of like 'heredocs'. Basically it's to avoid having to escape ' in your function bodies, or other strings, eg: CREATE FUNCTION test(int) RETURNS int AS $tagname$ SELECT 23 FROM table WHERE a > $1 AND b = 'hello' $tagname$ LANGUAGE SQL; The 'tagname' is the dollar quote identifier, and everything from that dollar quote opener to the end one will be considered a string literal. Notice I do not have to escape the '' in the function body. It a perfectly reasonable thing, even encouraged thing to do. We'll just have to upgrade the SQL parser to cope :P Prepared query parameters are indicated with $n syntax in PostgreSQL, just to make things tricky :D ie: SELECT * FROM blah WHERE a = $1 AND b = $2; The $1 will get replaced with first param, $2 with second, etc. Maybe support should be added for this style of notation? It'd be pretty easy I guess. > I welcome native postgres prepare/bind/execute support, and don't mind > adjusting the pdo_sql_parser.re code to cater for rewriting ? or > :named style substitutions into postgres style; it already includes > some logic for rewriting ? to :named and vice-versa, so the > modifications should be reasonably simple. Might be necessary. Chris