1 | <?php |
||
35 | abstract class StatementAbstract extends ObjectAbstract implements StatementInterface |
||
36 | { |
||
37 | use DriverAwareTrait; |
||
38 | |||
39 | /** |
||
40 | * prepared statement |
||
41 | * |
||
42 | * @var mixed |
||
43 | * @access protected |
||
44 | */ |
||
45 | protected $prepared; |
||
46 | |||
47 | /** |
||
48 | * Result prototype |
||
49 | * |
||
50 | * @var ResultInterface |
||
51 | * @access protected |
||
52 | */ |
||
53 | protected $result_prototype; |
||
54 | |||
55 | /** |
||
56 | * @var ResultInterface |
||
57 | * @access protected |
||
58 | */ |
||
59 | protected $result; |
||
60 | |||
61 | /** |
||
62 | * Desctructor |
||
63 | * |
||
64 | * @access public |
||
65 | */ |
||
66 | public function __destruct() |
||
70 | |||
71 | /** |
||
72 | * {@inheritDoc} |
||
73 | */ |
||
74 | public function prepare(/*# string */ $sql)/*# : bool */ |
||
95 | |||
96 | /** |
||
97 | * {@inheritDoc} |
||
98 | */ |
||
99 | public function execute(array $parameters = [])/*# : bool */ |
||
126 | |||
127 | /** |
||
128 | * {@inheritDoc} |
||
129 | */ |
||
130 | public function getResult()/*# : ResultInterface */ |
||
140 | |||
141 | /** |
||
142 | * {@inheritDoc} |
||
143 | */ |
||
144 | public function close() |
||
155 | |||
156 | /** |
||
157 | * Throw exception if not prepared |
||
158 | * |
||
159 | * @throws RuntimeException |
||
160 | * @access protected |
||
161 | */ |
||
162 | protected function checkPreparation() |
||
175 | |||
176 | /** |
||
177 | * Close resultset if any |
||
178 | * |
||
179 | * @access protected |
||
180 | */ |
||
181 | protected function closeResult() |
||
188 | |||
189 | /** |
||
190 | * Driver specific prepare statement |
||
191 | * |
||
192 | * @param mixed $link db link resource |
||
193 | * @param string $sql |
||
194 | * @return mixed |
||
195 | * @throws RuntimeException |
||
196 | * @access protected |
||
197 | */ |
||
198 | abstract protected function realPrepare($link, /*# string */ $sql); |
||
199 | |||
200 | /** |
||
201 | * Driver specific statement execution |
||
202 | * |
||
203 | * @param array $parameters |
||
204 | * @return bool |
||
205 | * @throws RuntimeException |
||
206 | * @access protected |
||
207 | */ |
||
208 | abstract protected function realExecute(array $parameters)/*# : bool */; |
||
209 | |||
210 | /** |
||
211 | * Close statement |
||
212 | * |
||
213 | * @param mixed prepared low-level statement |
||
214 | * @access protected |
||
215 | */ |
||
216 | abstract protected function realClose($stmt); |
||
217 | } |
||
218 |