| 6 | | class HermitStatement { |
| 7 | | protected $parameter; |
| 8 | | protected $statement; |
| 9 | | public function __construct(HermitSqlParameter $parameter, PDOStatement $statement){ |
| 10 | | $this->parameter = $parameter; |
| 11 | | $this->statement = $statement; |
| 12 | | } |
| 13 | | public function getSqlParameter(){ |
| 14 | | return $this->parameter; |
| 15 | | } |
| 16 | | public function execute($parameterValue = array()){ |
| 17 | | $this->parameter->bind($this->statement, $parameterValue); |
| 18 | | return $this->statement->execute(); |
| 19 | | } |
| 20 | | public function fetch(){ |
| 21 | | $args = func_get_args(); |
| 22 | | $c = count($args); |
| 23 | | if($c < 1){ |
| 24 | | return $this->statement->fetch(); |
| 25 | | } |
| 26 | | if($c < 2){ |
| 27 | | return $this->statement->fetch($args[0]); |
| 28 | | } |
| 29 | | return call_user_func_array(array($this->statement, 'fetch'), $args); |
| 30 | | } |
| 31 | | public function __call($name, $params){ |
| 32 | | return call_user_func_array(array($this->statement, $name), $params); |
| 33 | | } |
| | 6 | interface HermitStatement { |
| | 7 | public function getSqlParameter(); |
| | 8 | public function execute($parameterValue = array()); |
| | 9 | public function __call($name, $params); |