summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/mysql_statement.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-12-16 15:17:13 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-12-16 15:17:13 +0100
commit205d209de931d5c5e1535277531a7e4dc8a6000a (patch)
treec10d6519c5f833ce0d408e52211247484627721c /ext/pdo_mysql/mysql_statement.c
parent1a66d64717d08e9b7f7c9328be673018cfe28c11 (diff)
downloadphp-git-205d209de931d5c5e1535277531a7e4dc8a6000a.tar.gz
PDO MySQL: Use mysqlnd column names
mysqlnd already creates interned zend_strings for us, so let's make use of them. This also required updating the PDO case changing code to work with potentially shared strings. For the lowercasing, use the optimized zend_string_tolower() implementation.
Diffstat (limited to 'ext/pdo_mysql/mysql_statement.c')
-rw-r--r--ext/pdo_mysql/mysql_statement.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 871b7f9c7c..180a4616ef 100644
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -619,7 +619,11 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */
if (S->H->fetch_table_names) {
cols[i].name = strpprintf(0, "%s.%s", S->fields[i].table, S->fields[i].name);
} else {
+#ifdef PDO_USE_MYSQLND
+ cols[i].name = zend_string_copy(S->fields[i].sname);
+#else
cols[i].name = zend_string_init(S->fields[i].name, S->fields[i].name_length, 0);
+#endif
}
cols[i].precision = S->fields[i].decimals;