| Conditions | 6 |
| Paths | 24 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function execute(array $data = [], bool $buff = true) : ResultInterface |
||
| 21 | { |
||
| 22 | if (!is_array($data)) { |
||
| 23 | $data = array(); |
||
| 24 | } |
||
| 25 | $temp = (is_array($data) && count($data)) ? |
||
| 26 | \pg_query_params($this->driver, $this->statement, $data) : |
||
| 27 | \pg_query_params($this->driver, $this->statement, array()); |
||
| 28 | if (!$temp) { |
||
| 29 | throw new DBException('Could not execute query : '.\pg_last_error($this->driver).' <'.$this->statement.'>'); |
||
| 30 | } |
||
| 31 | $aff = 0; |
||
| 32 | if (preg_match('@^\s*(INSERT|UPDATE|DELETE)\s+@i', $this->statement)) { |
||
| 33 | $aff = @\pg_affected_rows($temp); |
||
| 34 | } |
||
| 35 | |||
| 36 | return new Result($temp, $this->driver, $aff); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |