1 | <?php |
||
15 | abstract class AbsractAdapter |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var void variavel com tipo de dados para serem convertida |
||
20 | */ |
||
21 | protected $dataTypes; |
||
22 | |||
23 | /** |
||
24 | * @type \PDO |
||
25 | */ |
||
26 | protected $_pdo; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | protected $port; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $host; |
||
37 | |||
38 | /** |
||
39 | * @type string |
||
40 | */ |
||
41 | protected $username; |
||
42 | |||
43 | /** |
||
44 | * @type string |
||
45 | */ |
||
46 | protected $password; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $database; |
||
52 | |||
53 | /** |
||
54 | * @type string |
||
55 | */ |
||
56 | protected $socket; |
||
57 | |||
58 | /** |
||
59 | * @type \Classes\Db\DbTable[][] |
||
60 | */ |
||
61 | private $objDbTables = array (); |
||
62 | |||
63 | /** |
||
64 | * @var AbstractAdapter |
||
65 | */ |
||
66 | protected $config; |
||
67 | |||
68 | /** |
||
69 | * @type int |
||
70 | */ |
||
71 | protected $totalTables; |
||
72 | |||
73 | /** |
||
74 | * analisa e popula as Foreing keys, Primary keys e dependencias do banco nos objetos |
||
75 | */ |
||
76 | protected function parseConstrants () |
||
95 | |||
96 | /** |
||
97 | * @param array $constrant |
||
98 | * @param string $table_name |
||
99 | * @param int $schema |
||
100 | */ |
||
101 | private function populateForeignAndPrimaryKeys ( $constrant , $table_name , $schema = 0 ) |
||
138 | |||
139 | /** |
||
140 | * @param array $constrant |
||
141 | * @param string $table_name |
||
142 | * @param int $schema |
||
143 | */ |
||
144 | private function populateDependece ( $constrant , $table_name , $schema = 0 ) |
||
161 | |||
162 | /** |
||
163 | * cria um Array com nome das tabelas |
||
164 | */ |
||
165 | protected abstract function parseTables (); |
||
166 | |||
167 | /** |
||
168 | * retorna o numero total de tabelas |
||
169 | * |
||
170 | * @return int |
||
171 | */ |
||
172 | public abstract function getTotalTables (); |
||
173 | |||
174 | /** |
||
175 | * Retorna o Nome da Sequence da tabela |
||
176 | * |
||
177 | * @param $table |
||
178 | * @param $column |
||
179 | * |
||
180 | * @return string |
||
181 | */ |
||
182 | public abstract function getSequence ( $table , $column ); |
||
183 | |||
184 | /** |
||
185 | * @return array |
||
186 | */ |
||
187 | public abstract function getListConstrant (); |
||
188 | |||
189 | /** |
||
190 | * @param string $str |
||
191 | * |
||
192 | * @return string |
||
193 | */ |
||
194 | protected function convertTypeToPhp ( $str ) |
||
203 | |||
204 | /** |
||
205 | * @return string |
||
206 | */ |
||
207 | public abstract function getPDOString (); |
||
208 | |||
209 | /** |
||
210 | * @return string |
||
211 | */ |
||
212 | public abstract function getPDOSocketString (); |
||
213 | |||
214 | /** |
||
215 | * @param $nameTable |
||
216 | * @param int $schema |
||
217 | * |
||
218 | * @return \Classes\Db\DbTable |
||
219 | */ |
||
220 | public function createTable ( $nameTable , $schema = 0 ) |
||
233 | |||
234 | /** |
||
235 | * Retorna um Array Assoc com a chave com nome da tabela e o valor com objeto tables |
||
236 | * |
||
237 | * @return \Classes\Db\DbTable[] |
||
238 | */ |
||
239 | public function getTables ( $schema = 0 ) |
||
248 | |||
249 | public function getAllTables () |
||
253 | |||
254 | public function hasTables () |
||
258 | |||
259 | /** |
||
260 | * retorna a tabela especifica |
||
261 | * |
||
262 | * @param $nameTable Nome da tabela |
||
263 | * |
||
264 | * @return \Classes\Db\DbTable |
||
265 | */ |
||
266 | public function getTable ( $nameTable , $schema = 0 ) |
||
270 | |||
271 | /** |
||
272 | * @param string $nameTable |
||
273 | * @param int|string $schema |
||
274 | * |
||
275 | * @return bool |
||
276 | */ |
||
277 | public function hasTable ( $nameTable , $schema = 0 ) |
||
281 | |||
282 | /** |
||
283 | * retorna multiplos arrays com dados da column em array |
||
284 | * |
||
285 | * @return array[] |
||
286 | */ |
||
287 | public abstract function getListColumns (); |
||
288 | |||
289 | /** |
||
290 | * Retorna um Array com nome das tabelas |
||
291 | * |
||
292 | * @return string[] |
||
293 | */ |
||
294 | public abstract function getListNameTable (); |
||
295 | |||
296 | /** |
||
297 | * @param \Classes\AdapterConfig\AbstractAdapter $adapterConfig |
||
298 | */ |
||
299 | public function __construct ( AbstractAdapter $adapterConfig ) |
||
311 | |||
312 | /** |
||
313 | * Executa as consultas do banco de dados |
||
314 | */ |
||
315 | public function runDatabase () |
||
320 | |||
321 | /** |
||
322 | * |
||
323 | * @return \PDO |
||
324 | */ |
||
325 | public function getPDO () |
||
350 | } |
||
351 |
As per the PSR-2 coding standard, there must be a space after the
case
keyword, instead of the test immediately following it.To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.