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) |
|
132 | |||
133 | /** |
||
134 | * Sets the key of the specified column. |
||
135 | * |
||
136 | * @param mixed $row |
||
137 | * @param \Rougin\Describe\Column &$column |
||
138 | * @return void |
||
139 | */ |
||
140 | 48 | protected function setKey($row, Column &$column) |
|
159 | |||
160 | /** |
||
161 | * Sets the properties of the specified column. |
||
162 | * |
||
163 | * @param \PDOStatement $foreignTable |
||
164 | * @param mixed $row |
||
165 | * @param \Rougin\Describe\Column &$column |
||
166 | * @return void |
||
167 | */ |
||
168 | 48 | protected function setForeignColumns($foreignTable, $row, Column &$column) |
|
179 | |||
180 | /** |
||
181 | * Sets the properties of the specified column. |
||
182 | * |
||
183 | * @param mixed $row |
||
184 | * @param \Rougin\Describe\Column &$column |
||
185 | * @return void |
||
186 | */ |
||
187 | 48 | protected function setProperties($row, Column &$column) |
|
199 | |||
200 | /** |
||
201 | * Strips the table schema from the table name. |
||
202 | * |
||
203 | * @param string $table |
||
204 | * @return string |
||
205 | */ |
||
206 | 45 | protected function stripTableSchema($table) |
|
210 | } |
||
211 |