for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Lagdo\DbAdmin\Driver\PgSql\Db\PgSql;
use Lagdo\DbAdmin\Driver\Db\StatementInterface;
use Lagdo\DbAdmin\Driver\Entity\StatementFieldEntity;
class Statement implements StatementInterface
{
/**
* @var resource
*/
protected $result;
* @var int
protected $offset = 0;
* The constructor
*
* @param resource $result
public function __construct($result)
$this->result = $result;
}
* @inheritDoc
public function rowCount()
return pg_num_rows($this->result);
public function fetchAssoc()
return pg_fetch_assoc($this->result);
public function fetchRow()
return pg_fetch_row($this->result);
public function fetchField()
$column = $this->offset++;
// $table = function_exists('pg_field_table') ? pg_field_table($this->result, $column) : '';
$table = pg_field_table($this->result, $column);
$name = pg_field_name($this->result, $column);
$type = pg_field_type($this->result, $column);
return new StatementFieldEntity($type, $type === "bytea", $name, $name, $table, $table);
* The destructor
public function __destruct()
pg_free_result($this->result);