facebook / facebook/hhvm

Slow

Open
#8,689 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

https://github.com/facebook/hhvm/blob/2213d8acd42464bfae0a8dc96a16b2092c22ba1d/hphp/runtime/ext/mysql/mysql_common.cpp#L1411

In each iteration -> getFieldCount() and checking result type

Maybe:
```c
// 1411
int fieldCound = res->getFieldCount();
if (fieldCound == 0) {
return ret; //Return array() in cases when no data present
}

if (result_type & PHP_MYSQL_NUM) {
for (int i = 0; i < fieldCound; i++) {
ret.set(i, res->getField(i));
}
} else if (result_type & PHP_MYSQL_ASSOC) {
for (int i = 0; i < fieldCound; i++) {
MySQLFieldInfo *info = res->getFieldInfo(i);
auto const arrkey =
ret.convertKey(info->name);
ret.set(arrkey, *res->getField(i).asTypedValue());
}
}
// 1421
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.