> 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.