On 6 Mar 2002, Jeffrey W. Baker wrote:
> Given I've been unable to contact Mr. Mergl on his own terms and given
> DBD::Pg is unreliable, unbuildable, and generally in a bad condition, I
> propose to make the next release of DBD::Pg myself.
>
> Several users have mailed patches to me or to this list. I will roll
> them up, test the driver, and upload a new package to my directory on
> CPAN.
>
Another patch...
This fixes a problem with \' and placeholders.
I sent it (or one similar) to the list a long while ago,
and since you are applying patches, I did not want this issue to
get overlooked.
Rudy
--- dbdimp.c.orig Mon Nov 26 16:58:51 2001
+++ dbdimp.c Wed Nov 28 15:26:38 2001
@@ -615,12 +615,13 @@
{
bool in_literal = FALSE;
char in_comment = '\0';
- char *src, *start, *dest;
+ char *src, *start, *dest, *str;
phs_t phs_tpl;
SV *phs_sv;
int idx=0;
char *style="", *laststyle=Nullch;
STRLEN namelen;
+ int bs; /* Number of backslashes before a ' */
if (dbis->debug >= 1) { fprintf(DBILOGFP, "dbd_st_preparse: statement
= >%s<\n", statement); }
@@ -652,8 +653,16 @@
if (in_literal) {
/* check if literal ends but keep quotes in literal */
- if (*src == in_literal && *(src-1) != '\\') {
- in_literal = 0;
+ if (*src == in_literal) {
+ if (*(src-1) == '\\') {
+ bs=0;
+ str = src-1;
+ while (*(str-bs++) == '\\');
+ if (!(bs & 1))
+ in_literal = 0;
+ } else {
+ in_literal = 0;
+ }
}
*dest++ = *src++;
continue;