1 | <?php |
||
29 | abstract class Base_PDO extends \csphere\core\database\Base |
||
30 | { |
||
31 | /** |
||
32 | * Stores the database connection |
||
33 | **/ |
||
34 | protected $con = null; |
||
35 | |||
36 | /** |
||
37 | * Returns a formatted array with statistics |
||
38 | * |
||
39 | * @return array |
||
40 | **/ |
||
|
|||
41 | |||
42 | public function info() |
||
52 | |||
53 | /** |
||
54 | * Handle database driver specific transactions |
||
55 | * |
||
56 | * @param string $command One of these strings: begin, commit, rollback |
||
57 | * |
||
58 | * @return boolean |
||
59 | **/ |
||
60 | |||
61 | public function transaction($command) |
||
79 | |||
80 | /** |
||
81 | * Sends a command to the database and gets the affected rows |
||
82 | * |
||
83 | * @param string $prepare Prepared query string with placeholders |
||
84 | * @param array $assoc Array with columns and values |
||
85 | * @param boolean $replace If more than {pre} needs to be replaced |
||
86 | * @param boolean $insertid Return the last insert id instead of a rowcount |
||
87 | * @param boolean $log Defaults to true which enables log files if used |
||
88 | * |
||
89 | * @return integer |
||
90 | **/ |
||
91 | |||
92 | public function exec( |
||
115 | |||
116 | /** |
||
117 | * Returns the ID of the last insert query |
||
118 | * |
||
119 | * @return integer |
||
120 | **/ |
||
121 | |||
122 | protected function insertId() |
||
126 | |||
127 | /** |
||
128 | * Sends a query to the database and fetches the result |
||
129 | * |
||
130 | * @param string $prepare Prepared query string with placeholders |
||
131 | * @param array $assoc Array with columns and values |
||
132 | * @param integer $first Number of the first dataset to show |
||
133 | * @param integer $max Number of datasets to show from first on |
||
134 | * |
||
135 | * @return array |
||
136 | **/ |
||
137 | |||
138 | public function query($prepare, array $assoc, $first = 0, $max = 1) |
||
172 | |||
173 | /** |
||
174 | * Executes a query |
||
175 | * |
||
176 | * @param string $prepare Prepared query string with placeholders |
||
177 | * @param array $assoc Array with columns and values |
||
178 | * @param boolean $log Save query info to log files |
||
179 | * |
||
180 | * @return \PDOStatement |
||
181 | **/ |
||
182 | |||
183 | private function _execute($prepare, array $assoc, $log) |
||
219 | |||
220 | /** |
||
221 | * Builds the query string part for limit and offset |
||
222 | * |
||
223 | * @param integer $first Number of the first dataset to show |
||
224 | * @param integer $max Number of datasets to show from first on |
||
225 | * |
||
226 | * @return string |
||
227 | **/ |
||
228 | |||
229 | abstract protected function limits($first, $max); |
||
230 | |||
231 | /** |
||
232 | * Replaces driver specific query placeholders |
||
233 | * |
||
234 | * @param string $replace The string to use for replaces |
||
235 | * |
||
236 | * @return string |
||
237 | **/ |
||
238 | |||
239 | abstract protected function replace($replace); |
||
240 | } |
||
241 |