Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Optimize Query::bindResult() #4

Closed
WolfgangDrescher opened this issue Jul 29, 2014 · 2 comments
Closed

Optimize Query::bindResult() #4

WolfgangDrescher opened this issue Jul 29, 2014 · 2 comments

Comments

@WolfgangDrescher
Copy link
Owner

The Query::bindResult() method (view source) currently needs all parameters you want to bind a result to explicit as referenced method arguments, which limits the number of parameters to maximum of 26 variables (&$a = null, … &$z = null).

This method is also forced to use debug_backtrace(false) to pass the reference to a internal class variable, since func_get_args() does not support a return of the references.

@WolfgangDrescher
Copy link
Owner Author

As a workaround or if you need more than 26 bound result variables the clean way to use this functionality is to use the native MySQLi methods as followed:

$stmt = new Query("SELECT id, name, email FROM user");
$stmt->send();
$stmt->getStatement()->bind_result($id, $name, $email);
while($this->getStatement()->fetch()) {
    echo "User-ID: $id, Name: $name, E-Mail: $email.";
}

@WolfgangDrescher
Copy link
Owner Author

Closing issue because if the change form MySQLi to PDO.

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

No branches or pull requests

1 participant