Hirdetés

2024. május 10., péntek

Gyorskeresés

Hozzászólások

(#21) lezso6 válasza modder (#18) üzenetére


lezso6
HÁZIGAZDA
LOGOUT blog

(#17) Sk8erPeter: Nagyképűség ON ;] :P :DDD

Nem kell fetchelni:

class PostgresResult implements Iterator
{
private $_connection;

private $_result = NULL;

private $_key = 0;

private $_size;

private $_cache = array();

public function __construct($connection)
{
$this->_connection = $connection;
}

public function __destruct()
{
pg_free_result($this->_result);
}

public function current()
{
if($this->_result === null) {
$this->_result = pg_get_result($this->_connection);
$this->_size = pg_num_rows($this->_result);
}
if(!isset($this->_cache[$this->_key])) {
$this->_cache[$this->_key] = pg_fetch_assoc($this->_result, $this->_key);
}

return $this->_cache[$this->_key];
}

public function key()
{
return $this->_key;
}

public function next()
{
$this->_key++;
}

public function rewind()
{
$this->_key = 0;
}

public function valid()
{
return $this->_key < $this->_size;
}
}

[ Szerkesztve ]

A RIOS rendkívül felhasználóbarát, csak megválogatja a barátait.

Copyright © 2000-2024 PROHARDVER Informatikai Kft.