Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved DBMySQLi::query #991

Merged
merged 3 commits into from
Nov 13, 2013
Merged

Improved DBMySQLi::query #991

merged 3 commits into from
Nov 13, 2013

Conversation

theonlynexus
Copy link

Improved the function:

  • appropriate use of mysqli::fetch_all instead of loop
  • improved checks on the result

danielkerr pushed a commit that referenced this pull request Nov 13, 2013
@danielkerr danielkerr merged commit 2002a33 into opencart:master Nov 13, 2013
@ghost
Copy link

ghost commented Nov 13, 2013

What specifically is improved? Also the coding style is way off what OpenCart uses (Yoda conditions!).

@theonlynexus
Copy link
Author

Uhm, sorry about the style: I am new to OpenCart and couldn't find a style guide straight away.

The function is improved in that it properly uses mysqli::fetch_all (don't really need the loop) and it uses the result for error checking avoiding nested if's. At least that is my reasoning behind the pull request.

@ghost
Copy link

ghost commented Nov 13, 2013

It would have helped to look at how all the other database drivers are structured.

@theonlynexus
Copy link
Author

Well, I get it and I am sorry, but I only made the request: it could have been rejected. Pull requests are supposed to be reviewed, or am I wrong?

@ghost
Copy link

ghost commented Nov 13, 2013

Who knows. The project's github management is not consistent.

jamesallsup pushed a commit that referenced this pull request Nov 13, 2013
@theonlynexus
Copy link
Author

OK, I have been thinking about how to reply to this, because participating in open source projects always results in this kind of problems.

Since I still think that my approach is better because it uses the API more consistently (there is an API function to do exactly what the for loop does, and the return value of the query should be checked before checking for errors, although the latter would be set only on failure in this particular case) there are two solutions that I see feasible:

  • I correct my submission to be similar to the rest of the code (you really need a coding standard, though)
  • You revert my changes, since, thank goodness, Git is a code versioning system

@p4norman
Copy link

I get this:

Fatal error: Call to undefined method mysqli_result::fetch_all()

My host's php does not include mysqlnd - a native driver, so mysqli::fetch_all() is not available

@jamesallsup
Copy link
Contributor

This was already resolved. Please use the latest version.

2f6741c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants