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.
This commit is contained in:
Nikita Popov 2020-12-16 15:17:13 +01:00
parent 1a66d64717
commit 205d209de9
3 changed files with 27 additions and 11 deletions

View file

@ -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;