1 | <?php |
||
17 | class MySQLDriver extends AbstractDriver implements DriverInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $database; |
||
23 | |||
24 | /** |
||
25 | * @var \PDO |
||
26 | */ |
||
27 | protected $pdo; |
||
28 | |||
29 | /** |
||
30 | * Initializes the driver instance. |
||
31 | * |
||
32 | 60 | * @param \PDO $pdo |
|
33 | * @param string $database |
||
34 | 60 | */ |
|
35 | 60 | public function __construct(\PDO $pdo, $database) |
|
43 | |||
44 | /** |
||
45 | 51 | * Returns an array of Column instances from a table. |
|
46 | * |
||
47 | 51 | * @param string $table |
|
48 | * @return \Rougin\Describe\Column[] |
||
49 | */ |
||
50 | public function columns($table) |
||
54 | |||
55 | /** |
||
56 | * Returns an array of Column instances from a table. |
||
57 | * NOTE: To be removed in v2.0.0. Use columns() instead. |
||
58 | 51 | * |
|
59 | * @param string $table |
||
60 | 51 | * @return \Rougin\Describe\Column[] |
|
61 | */ |
||
62 | public function getColumns($table) |
||
66 | |||
67 | /** |
||
68 | 9 | * Returns an array of Column instances from a table. |
|
69 | * NOTE: To be removed in v2.0.0. Use getColumns() instead. |
||
70 | 9 | * |
|
71 | * @param string $table |
||
72 | * @return \Rougin\Describe\Column[] |
||
73 | */ |
||
74 | public function getTable($table) |
||
78 | |||
79 | 9 | /** |
|
80 | * Returns an array of table names. |
||
81 | 9 | * NOTE: To be removed in v2.0.0. Use tables() instead. |
|
82 | * |
||
83 | 9 | * @return array |
|
84 | 9 | */ |
|
85 | public function getTableNames() |
||
89 | |||
90 | 9 | /** |
|
91 | * Returns an array of table names. |
||
92 | * NOTE: To be removed in v2.0.0. Use getTableNames() instead. |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | public function showTables() |
||
100 | 48 | ||
101 | /** |
||
102 | 48 | * Returns an array of Table instances. |
|
103 | * |
||
104 | 48 | * @return \Rougin\Describe\Table[] |
|
105 | */ |
||
106 | public function tables() |
||
110 | |||
111 | 48 | /** |
|
112 | 48 | * Prepares the defined columns. |
|
113 | 48 | * |
|
114 | 48 | * @param \Rougin\Describe\Column $column |
|
115 | * @param string $table |
||
116 | 48 | * @param mixed $row |
|
117 | 48 | * @return \Rougin\Describe\Column |
|
118 | 48 | */ |
|
119 | protected function column(Column $column, $table, $row) |
||
141 | 48 | ||
142 | /** |
||
143 | 48 | * Sets the properties of a column if it does exists. |
|
144 | 48 | * |
|
145 | * @param string $name |
||
146 | 48 | * @param mixed $row |
|
147 | 48 | * @param \Rougin\Describe\Column $column |
|
148 | * @return \Rougin\Describe\Column |
||
149 | 48 | */ |
|
150 | protected function foreign($name, $row, Column $column) |
||
175 | |||
176 | 45 | /** |
|
177 | 45 | * Returns an array of table names or Table instances. |
|
178 | 45 | * NOTE: To be removed in v2.0.0. Move to tables() instead. |
|
179 | 45 | * |
|
180 | * @param boolean $instance |
||
181 | 48 | * @param array $tables |
|
182 | * @return array|\Rougin\Describe\Table[] |
||
183 | */ |
||
184 | protected function items($instance = false, $tables = array()) |
||
199 | 48 | ||
200 | 48 | /** |
|
201 | 48 | * Sets the key of a column. |
|
202 | * |
||
203 | 48 | * @param mixed $row |
|
204 | * @param \Rougin\Describe\Column $column |
||
205 | * @return \Rougin\Describe\Column |
||
206 | */ |
||
207 | protected function keys($row, Column $column) |
||
228 | |||
229 | /** |
||
230 | * Sets the properties of a column. |
||
231 | * |
||
232 | * @param mixed $row |
||
233 | * @param \Rougin\Describe\Column $column |
||
234 | * @return \Rougin\Describe\Column |
||
235 | */ |
||
236 | protected function properties($row, Column $column) |
||
246 | |||
247 | /** |
||
248 | * Strips the table schema from the table name. |
||
249 | * |
||
250 | * @param string $table |
||
251 | * @return string |
||
252 | */ |
||
253 | protected function strip($table) |
||
261 | } |
||
262 |