Skip to content

Commit e5fa4ec

Browse files
ext/mysqlnd: Use iterated struct and remove dulicate SET_AFFECTED_ROWS (#21713)
1 parent 608c3ed commit e5fa4ec

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

ext/mysqlnd/mysqlnd_result.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,6 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND_CONN_DATA * const c
720720

721721
if (ret == FAIL) {
722722
COPY_CLIENT_ERROR(&set->error_info, row_packet.error_info);
723-
} else {
724-
/* libmysql's documentation says it should be so for SELECT statements */
725-
UPSERT_STATUS_SET_AFFECTED_ROWS(conn->upsert_status, set->row_count);
726723
}
727724
DBG_INF_FMT("ret=%s row_count=%u warnings=%u server_status=%u",
728725
ret == PASS? "PASS":"FAIL",
@@ -1002,18 +999,11 @@ MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, const unsigned int
1002999
}
10031000
}
10041001
if (flags & MYSQLND_FETCH_ASSOC) {
1005-
/* zend_hash_quick_update needs length + trailing zero */
1006-
/* QQ: Error handling ? */
1007-
/*
1008-
zend_hash_quick_update does not check, as add_assoc_zval_ex do, whether
1009-
the index is a numeric and convert it to it. This however means constant
1010-
hashing of the column name, which is not needed as it can be precomputed.
1011-
*/
10121002
Z_TRY_ADDREF_P(data);
1013-
if (meta->fields[i].is_numeric == FALSE) {
1014-
zend_hash_update(row_ht, meta->fields[i].sname, data);
1003+
if (field->is_numeric == FALSE) {
1004+
zend_hash_update(row_ht, field->sname, data);
10151005
} else {
1016-
zend_hash_index_update(row_ht, meta->fields[i].num_key, data);
1006+
zend_hash_index_update(row_ht, field->num_key, data);
10171007
}
10181008
}
10191009

0 commit comments

Comments
 (0)