Open
Conversation
fetch_array returns an array that contains the results of fetch_row and fetch_assoc making it twice as big than need be. I don't think we have a case where we use both at the same time, so we shouldn't use fetch_array. We should use fetch_assoc and where we can fetch_row.
Member
|
This appears to be failing. fetch_array may be used for performance reasons. Database result unpacking is a performance bottleneck. fetch_array avoids the step where the database driver has to query for the names of the database fields and then associate those names with the results. What problem are you trying to solve? |
Author
|
Not really solving a problem. Just noticed this when doing something else.
fetch_row would be faster , I know, but that is not what I'm proposing. I'm
proposing swapping out fetch_array with fetch_assoc since we're not using
the numeric keys anyway (unless I'm mistaken).
according to : http://php.net/manual/en/mysqli-result.fetch-array.php
/* associative array returns both numeric keys and column names*/
$row = $result->fetch_array(MYSQLI_BOTH);
printf ("%s (%s)\n", $row[0], $row["CountryCode"]);
/* return only column names*/
$row = $result->fetch_assoc(MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
2018-05-31 16:27 GMT+02:00 Shannon <notifications@github.com>:
… This appears to be failing. fetch_array may be used for performance
reasons. Database result unpacking is a performance bottleneck. fetch_array
avoids the step where the database driver has to query for the names of the
database fields and then associate those names with the results.
What problem are you trying to solve?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADXnE7Zw1CeFR_7ax4EMlDacg2dqzM96ks5t3_3vgaJpZM4UU-bA>
.
|
Author
|
@spekary it's failing on hhvm. But I don't understand why. Can you see why this is happening? |
Member
|
Its saying CodeGen is undefined. Its probably a case problem. Maybe it should be Codegen? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fetch_array returns an array that contains the results of fetch_row and fetch_assoc making it twice as big than need be.
I don't think we have a case where we use both at the same time, so we shouldn't use fetch_array. We should use fetch_assoc and where we can fetch_row.