1 | <?php |
||
16 | class MySQLDriver implements DriverInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $columns = []; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $database; |
||
27 | |||
28 | /** |
||
29 | * @var \PDO |
||
30 | */ |
||
31 | protected $pdo; |
||
32 | |||
33 | /** |
||
34 | * @param PDO $pdo |
||
35 | * @param string $database |
||
36 | */ |
||
37 | 60 | public function __construct(\PDO $pdo, $database) |
|
42 | |||
43 | /** |
||
44 | * Returns the result. |
||
45 | * |
||
46 | * @param string $tableName |
||
47 | * @return array |
||
48 | */ |
||
49 | 51 | public function getTable($tableName) |
|
68 | |||
69 | /** |
||
70 | * Shows the list of tables. |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | 9 | public function showTables() |
|
87 | |||
88 | /** |
||
89 | * Prepares the defined columns. |
||
90 | * |
||
91 | * @param string $tableName |
||
92 | * @param mixed $row |
||
93 | * @return void |
||
94 | */ |
||
95 | 48 | protected function setColumns($tableName, $row) |
|
117 | |||
118 | /** |
||
119 | * Sets the key of the specified column. |
||
120 | * |
||
121 | * @param mixed $row |
||
122 | * @param \Rougin\Describe\Column &$column |
||
123 | * @return void |
||
124 | */ |
||
125 | 48 | protected function setKey($row, Column &$column) |
|
144 | |||
145 | /** |
||
146 | * Sets the properties of the specified column if it does exists. |
||
147 | * |
||
148 | * @param string $tableName |
||
149 | * @param mixed $row |
||
150 | * @param \Rougin\Describe\Column &$column |
||
151 | * @return void |
||
152 | */ |
||
153 | 48 | protected function setForeignColumn($tableName, $row, Column &$column) |
|
176 | |||
177 | /** |
||
178 | * Sets the properties of the specified column. |
||
179 | * |
||
180 | * @param mixed $row |
||
181 | * @param \Rougin\Describe\Column &$column |
||
182 | * @return void |
||
183 | */ |
||
184 | 48 | protected function setProperties($row, Column &$column) |
|
196 | |||
197 | /** |
||
198 | * Strips the table schema from the table name. |
||
199 | * |
||
200 | * @param string $table |
||
201 | * @return string |
||
202 | */ |
||
203 | 45 | protected function stripTableSchema($table) |
|
207 | } |
||
208 |