| Total Complexity | 6 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class Statement implements StatementInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var resource |
||
| 12 | */ |
||
| 13 | protected $result; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var int |
||
| 17 | */ |
||
| 18 | protected $offset = 0; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * The constructor |
||
| 22 | * |
||
| 23 | * @param resource $result |
||
| 24 | */ |
||
| 25 | public function __construct($result) |
||
| 26 | { |
||
| 27 | $this->result = $result; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @inheritDoc |
||
| 32 | */ |
||
| 33 | public function rowCount() |
||
| 34 | { |
||
| 35 | return pg_num_rows($this->result); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @inheritDoc |
||
| 40 | */ |
||
| 41 | public function fetchAssoc() |
||
| 42 | { |
||
| 43 | return pg_fetch_assoc($this->result); |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @inheritDoc |
||
| 48 | */ |
||
| 49 | public function fetchRow() |
||
| 50 | { |
||
| 51 | return pg_fetch_row($this->result); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritDoc |
||
| 56 | */ |
||
| 57 | public function fetchField() |
||
| 58 | { |
||
| 59 | $column = $this->offset++; |
||
| 60 | // $table = function_exists('pg_field_table') ? pg_field_table($this->result, $column) : ''; |
||
| 61 | $table = pg_field_table($this->result, $column); |
||
| 62 | $name = pg_field_name($this->result, $column); |
||
| 63 | $type = pg_field_type($this->result, $column); |
||
| 64 | return new StatementFieldEntity($type, $type === "bytea", $name, $name, $table, $table); |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * The destructor |
||
| 69 | */ |
||
| 70 | public function __destruct() |
||
| 73 | } |
||
| 74 | } |
||
| 75 |