-/* Generated by re2c 0.5 on Fri May 21 17:19:22 2004 */
+/* Generated by re2c 0.5 on Fri May 21 17:33:58 2004 */
#line 1 "/home/george/src/pecl/pdo/pdo_sql_parser.re"
/*
+----------------------------------------------------------------------+
*outquery_len += (s.cur - s.tok);
}
else if(t == PDO_PARSER_BIND) {
- char crutch;
if(!params) {
/* error */
efree(*outquery);
}
/* 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];
- s.tok[s.cur-s.tok] = '\0';
- fprintf(stderr, "%d %s\n", s.cur-s.tok + 1, s.tok);
- if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok + 1,(void **)¶m))
+ if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok,(void **)¶m))
||
(SUCCESS == zend_hash_index_find(params, bindno, (void **)¶m)))
{
char *quotedstr;
int quotedstrlen;
/* restore the in-string key, doesn't need null-termination here */
- s.tok[s.cur-s.tok] = crutch;
/* currently everything is a string here */
/* quote the bind value if necessary */
*outquery_len += (s.cur - s.tok);
}
else if(t == PDO_PARSER_BIND) {
- char crutch;
if(!params) {
/* error */
efree(*outquery);
}
/* 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];
- s.tok[s.cur-s.tok] = '\0';
- if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok + 1,(void **)¶m))
+ if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok,(void **)¶m))
||
(SUCCESS == zend_hash_index_find(params, bindno, (void **)¶m)))
{
char *quotedstr;
int quotedstrlen;
/* restore the in-string key, doesn't need null-termination here */
- s.tok[s.cur-s.tok] = crutch;
/* currently everything is a string here */
/* quote the bind value if necessary */
if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(input_params),
¶m.name, &str_length, &num_index, 0, NULL)) {
- param.namelen = str_length;
+ /* yes this is correct. we don't want to count the null byte. ask wez */
+ param.namelen = str_length - 1;
param.paramno = -1;
} else {
/* we're okay to be zero based here */
static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param)
{
struct pdo_bound_param_data param = {0};
- int param_namelen;
param.paramno = -1;
param.param_type = PDO_PARAM_STR;
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
ZEND_NUM_ARGS() TSRMLS_CC, "sz|llz!",
- ¶m.name, ¶m_namelen, ¶m.parameter, ¶m.param_type,
+ ¶m.name, ¶m.namelen, ¶m.parameter, ¶m.param_type,
¶m.max_value_len,
¶m.driver_params)) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|llz!", ¶m.paramno,
return 0;
}
}
- /*
- yes, this is correct. really. truly.
- We need to count the null terminating byte as well,
- which parse_parameters does not do.
- */
- param.namelen = param_namelen + 1;
if (param.paramno > 0) {
--param.paramno; /* make it zero-based internally */