summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-05-05 16:19:51 +0300
committerDmitry Stogov <dmitry@zend.com>2015-05-05 16:19:51 +0300
commit70c86732cb14bad0b2539a54c16e8e845f740117 (patch)
tree102cc8c5265f03b4f0bbd28cd13f29a101893480 /ext/pdo_mysql
parent275afbacd11c2f4d0dac7d450ffdf500d5eab104 (diff)
downloadphp-git-70c86732cb14bad0b2539a54c16e8e845f740117.tar.gz
Use zend_string to represent pdo_column_data.name and avoid duplication.
Diffstat (limited to 'ext/pdo_mysql')
-rw-r--r--ext/pdo_mysql/mysql_statement.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 56728ed92d..551960560e 100644
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -696,14 +696,11 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */
PDO_DBG_RETURN(1);
}
for (i = 0; i < stmt->column_count; i++) {
- int namelen;
if (S->H->fetch_table_names) {
- namelen = spprintf(&cols[i].name, 0, "%s.%s", S->fields[i].table, S->fields[i].name);
- cols[i].namelen = namelen;
+ cols[i].name = strpprintf(0, "%s.%s", S->fields[i].table, S->fields[i].name);
} else {
- cols[i].namelen = S->fields[i].name_length;
- cols[i].name = estrndup(S->fields[i].name, S->fields[i].name_length);
+ cols[i].name = zend_string_init(S->fields[i].name, S->fields[i].name_length, 0);
}
cols[i].precision = S->fields[i].decimals;