storing this object in ANY kind will result in storing an empty object... if you try to serialize it dump it or do anything with it you will end up with a empty object.
you have to pull all data out f the object and then store the data... no other way.
A classe MySQLi_Result
Introdução
Representa o conjunto de resultados da consulta feit ao banco de dados.
Sinopse da classe
MySQLi_Result
{
/* Propriedades */
array $mysqli_result->lengths;
/* Métodos */
int MySQLi_Result::mysqli_field_tell
( mysqli_result $result
)
bool mysqli_result::field_seek
( int $fieldnr
)
}Índice
- mysqli_result::$current_field — Get current field offset of a result pointer
- mysqli_result::data_seek — Ajusta o ponteiro do resultado para uma linha arbritaria no conjunto de resutados
- mysqli_result::fetch_all — Fetches all result rows as an associative array, a numeric array, or both
- mysqli_fetch_array — Obtem uma linha do resultado como uma matriz associativa, numérica, ou ambas
- mysqli_result::fetch_assoc — Obtem uma linha do conjunto de resultados como uma matriz associativa
- mysqli_fetch_field_direct — Obtem meta dados para um único campo
- mysqli_result::fetch_field — Retorna o próximo campo no conjunto de resultados
- mysqli_result::fetch_fields — Retorna uma matriz de objetos representando os campos em um conjunto de resultados
- mysqli_fetch_object — Retorna a linha atual do conjunto de resultados como um objeto
- mysqli_result::fetch_row — Obtém uma linha do resultado como uma matriz numerada
- mysqli_result::$field_count — Get the number of fields in a result
- mysqli_field_seek — Move o ponteiro do resultado para um campo especificado
- mysqli_result::free — Frees the memory associated with a result
- mysqli_result::$lengths — Returns the lengths of the columns of the current row in the result set
- mysqli_result::$num_rows — Gets the number of rows in a result
sinisaculic at gmail dot com
21-Oct-2010 07:58
Anonymous
18-Apr-2010 05:39
Generally, it appears Mysqli OO vs Procedural style has no significant difference in speed, at least with the more generally used functions and methods (connect, close, query, free, etc).
With the fetch_* family of functions and methods dealing with result rows, however, Procedural wins out. Averaging over a hundred or so tests with a result set of 180,000 records, and using mysqli_fetch_*() functions vs. their mysqli_result::fetch_*() counterpart object methods to read and iterate over all records, all of the mysqli_fetch_*() functions win by ~0.1 seconds less.
This is interesting considering we're dealing with the same result object in both styles.
This was using Vistax64, PHP5.3.2, Mysql 5.1.45, using a bit of this code:
<?php
// procedural - takes 0.1 seconds less than OO here
$stopwatch = microtime(true);
while($row = mysqli_fetch_assoc($result)){
++$z;
}
echo microtime(true) - $stopwatch;
// OO
$stopwatch = microtime(true);
while($row = $result->fetch_assoc()){
++$z;
}
echo microtime(true) - $stopwatch;
?>
blar at blar dot de
07-Jan-2009 07:47
Extending the MySQLi_Result
<?php
class Database_MySQLi extends MySQLi
{
public function query($query)
{
$this->real_query($query);
return new Database_MySQLi_Result($this);
}
}
class Database_MySQLi_Result extends MySQLi_Result
{
public function fetch()
{
return $this->fetch_assoc();
}
public function fetchAll()
{
$rows = array();
while($row = $this->fetch())
{
$rows[] = $row;
}
return $rows;
}
}
?>
