Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3EB31475AFA for ; Thu, 21 Nov 2002 05:53:36 -0500 (EST) Received: from mailhub1.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by postgresql.org (Postfix) with ESMTP id 676684758DC for ; Thu, 21 Nov 2002 05:53:35 -0500 (EST) Received: from [194.82.51.24] (helo=imail) by mailhub1.sghms.ac.uk with esmtp (Exim 4.05) id 18Eox3-0006xP-00; Thu, 21 Nov 2002 10:52:53 +0000 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.1 HotFix 0.7 (built May 7 2002)) with ESMTPA id <0H5X0051FA8VNO@imail.sghms.ac.uk>; Thu, 21 Nov 2002 10:53:20 +0000 (GMT) Date: Thu, 21 Nov 2002 10:53:32 +0000 From: Adam Witney In-reply-to: <289E1136-FC56-11D6-8F04-0003931A964A@wheeler.net> To: David Wheeler Cc: dbi-dev@perl.org, pgsql-interfaces Message-id: MIME-version: 1.0 User-Agent: Microsoft-Entourage/10.1.0.2006 Subject: Re: :PgSQL: More Queestions Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT X-Spam-Status: No, hits=-101.9 required=5.7 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,SPAM_PHRASE_01_02,USER_AGENT, USER_AGENT_ENTOURAGE,USER_IN_WHITELIST version=2.43 X-Spam-Level: X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/88 X-Sequence-Number: 3336 > I understand that the goal is to convert the placeholders from '?' or > ':nn' to the PostgreSQL internal version (':pn'). What I'm referring to > specifically, however, is this snippet from DBD::Pg: > > if (in_literal) { > /* Check if literal ends but keep quotes in literal */ > if (*src == in_literal) { > int bs = 0; > char *str; > str = src-1; /* Back a character. */ > while (*(str - bs) == '\\') > bs++; > if (!(bs & 1)) > /* bs is an even number? */ > in_literal = 0; > } > *dest++ = *src++; > continue; > } > > in_literal is set when the last character wasn't a placeholder > character ('?' or ':') and is either a single or a double quotation > mark. So while I understand that one might want to ignore placeholder > characters, I don't really understand what the above code is doing. > Probably'll be easier for me after I've been looking a C for a while... One thing you may want to keep in mind is the situation concerning array slices If you send a statement like this my $sth = $dbh->prepare("select cube[1:2][1][1] from test4"); Then the :2 gets treated as a placeholder and gets substituted. From the trace dbd_st_execute: statement = >select cube[1NULL][1][1] from test4< ERROR: parser: parse error at or near "NULL" at character 14 error 7 recorded: ERROR: parser: parse error at or near " NULL" at character 14 As no parameters have been bound to the placeholder then a NULL is substituted and so it fails. Or maybe I was doing it wrong and there is a way to get around this already? Thanks adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.