summaryrefslogtreecommitdiff
path: root/ext/pdo/pdo_sql_parser.c
diff options
context:
space:
mode:
authorGeorge Schlossnagle <gschlossnagle@php.net>2004-05-20 18:44:12 +0000
committerGeorge Schlossnagle <gschlossnagle@php.net>2004-05-20 18:44:12 +0000
commitc22cb0477ca18bfaa29f4287c69a11ffa9864347 (patch)
treee322c4bcb0b2c6c0ab3c6a23b204ebc796eda1ff /ext/pdo/pdo_sql_parser.c
parent336691620319153b030e8af118b1a59ba3e7948a (diff)
downloadphp-git-c22cb0477ca18bfaa29f4287c69a11ffa9864347.tar.gz
off by one error
Diffstat (limited to 'ext/pdo/pdo_sql_parser.c')
-rw-r--r--ext/pdo/pdo_sql_parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
index ddc86ca37d..5e112ec26f 100644
--- a/ext/pdo/pdo_sql_parser.c
+++ b/ext/pdo/pdo_sql_parser.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Thu May 20 13:12:59 2004 */
+/* Generated by re2c 0.5 on Thu May 20 13:51:55 2004 */
#line 1 "/home/george/src/pecl/pdo/pdo_sql_parser.re"
/*
+----------------------------------------------------------------------+
@@ -232,12 +232,14 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
if(!params) {
/* error */
efree(*outquery);
+ *outquery = NULL;
return (int) (s.cur - inquery);
}
/* lookup bind first via hash and then index */
/* stupid keys need to be null-terminated, even though we know their length */
- crutch = s.tok[s.cur-s.tok + 1];
+ crutch = s.tok[s.cur-s.tok];
s.tok[s.cur-s.tok] = '\0';
+fprintf(stderr, "looking up key: (%.*s)", s.cur-s.tok + 1, s.tok);
if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok + 1,(void **)&param))
||
(SUCCESS == zend_hash_index_find(params, bindno, (void **)&param)))
@@ -265,6 +267,7 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
else {
/* error and cleanup */
efree(*outquery);
+ *outquery = NULL;
return (int) (s.cur - inquery);
}
bindno++;
@@ -273,6 +276,7 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
if(!params) {
/* error */
efree(*outquery);
+ *outquery = NULL;
return (int) (s.cur - inquery);
}
/* lookup bind by index */
@@ -299,12 +303,14 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
else {
/* error and cleanup */
efree(*outquery);
+ *outquery = NULL;
return (int) (s.cur - inquery);
}
bindno++;
}
}
*ptr = '\0';
+fprintf(stderr, "good\n");
return 0;
}