I wrote a mysqli child with a query method that returns a mysqli_result child. This result will have additional methods unique to my application.
public MySQL extends mysqli
{
public function query($query)
{
if ($this->real_query($query)) {
if ($this->field_count > 0) {
return new MySQL_Result($this);
}
return true;
}
return false;
}
}
class MySQL_Result extends mysqli_result
{
public function fetch_objects() {
$rows = array();
while($row = $this->fetch_object())
$rows[$row->id] = $row;
return $rows;
}
}
I can’t understand if fetch_object()buffered or unbuffered SQL data is used.
The constructor mysqli_resultdoes not appear in mysqli.php, so I do not see its call $mysqli->store_result()or $mysqli->use_result().
I tried adding these methods to MySQL, but none of the functions echo.
public function store_result($option='a') {
echo "STORE RESULT<br/>";
}
public function use_result($option='a') {
echo "USE RESULT<br/>";
}
Does this mean that the constructor mysqli_resultdoesn’t call either? If so, how does it access SQL data when called fetch_object?
................
SQL. , , , , , $mysqli->store_result().
PHP/OOP . .