mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Switch name variable to zend_string
This commit is contained in:
parent
7aa00369b0
commit
792f8fb1b5
1 changed files with 4 additions and 5 deletions
|
@ -339,7 +339,6 @@ rewrite:
|
||||||
|
|
||||||
} else if (query_type == PDO_PLACEHOLDER_POSITIONAL) {
|
} else if (query_type == PDO_PLACEHOLDER_POSITIONAL) {
|
||||||
/* rewrite ? to :pdoX */
|
/* rewrite ? to :pdoX */
|
||||||
char *name;
|
|
||||||
const char *tmpl = stmt->named_rewrite_template ? stmt->named_rewrite_template : ":pdo%d";
|
const char *tmpl = stmt->named_rewrite_template ? stmt->named_rewrite_template : ":pdo%d";
|
||||||
int bind_no = 1;
|
int bind_no = 1;
|
||||||
|
|
||||||
|
@ -359,10 +358,10 @@ rewrite:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = estrndup(plc->pos, plc->len);
|
zend_string *name = zend_string_init(plc->pos, plc->len, 0);
|
||||||
|
|
||||||
/* check if bound parameter is already available */
|
/* check if bound parameter is already available */
|
||||||
if (!strcmp(name, "?") || (p = zend_hash_str_find_ptr(stmt->bound_param_map, name, plc->len)) == NULL) {
|
if (zend_string_equals_literal(name, "?") || (p = zend_hash_find_ptr(stmt->bound_param_map, name)) == NULL) {
|
||||||
idxbuf = zend_strpprintf(0, tmpl, bind_no++);
|
idxbuf = zend_strpprintf(0, tmpl, bind_no++);
|
||||||
} else {
|
} else {
|
||||||
idxbuf = zend_string_copy(p);
|
idxbuf = zend_string_copy(p);
|
||||||
|
@ -374,13 +373,13 @@ rewrite:
|
||||||
|
|
||||||
if (!skip_map && stmt->named_rewrite_template) {
|
if (!skip_map && stmt->named_rewrite_template) {
|
||||||
/* create a mapping */
|
/* create a mapping */
|
||||||
zend_hash_str_update_ptr(stmt->bound_param_map, name, plc->len, zend_string_copy(plc->quoted));
|
zend_hash_update_ptr(stmt->bound_param_map, name, zend_string_copy(plc->quoted));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* map number to name */
|
/* map number to name */
|
||||||
zend_hash_index_update_ptr(stmt->bound_param_map, plc->bindno, zend_string_copy(plc->quoted));
|
zend_hash_index_update_ptr(stmt->bound_param_map, plc->bindno, zend_string_copy(plc->quoted));
|
||||||
|
|
||||||
efree(name);
|
zend_string_release(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
goto rewrite;
|
goto rewrite;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue