1 | <?php |
||
11 | class MySQLRepository implements RepositoryInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var Connection |
||
15 | */ |
||
16 | private $connection; |
||
17 | |||
18 | /** |
||
19 | * MySQLRepository constructor. |
||
20 | * @param Connection $connection |
||
21 | */ |
||
22 | 59 | public function __construct(Connection $connection) |
|
26 | |||
27 | 55 | public function __destruct() |
|
31 | |||
32 | /** |
||
33 | * @param string $database |
||
34 | * @param string $table |
||
35 | * @return array |
||
36 | */ |
||
37 | 53 | public function getFields($database, $table) |
|
38 | { |
||
39 | $sql = ' |
||
40 | SELECT |
||
41 | `COLUMN_NAME`, |
||
42 | `COLLATION_NAME`, |
||
43 | `CHARACTER_SET_NAME`, |
||
44 | `COLUMN_COMMENT`, |
||
45 | `COLUMN_TYPE`, |
||
46 | `COLUMN_KEY` |
||
47 | FROM |
||
48 | `information_schema`.`COLUMNS` |
||
49 | WHERE |
||
50 | `TABLE_SCHEMA` = ? |
||
51 | AND |
||
52 | `TABLE_NAME` = ? |
||
53 | 53 | '; |
|
54 | |||
55 | 53 | return $this->getConnection()->fetchAll($sql, [$database, $table]); |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return Connection |
||
60 | */ |
||
61 | 58 | private function getConnection() |
|
70 | |||
71 | /** |
||
72 | * @return bool |
||
73 | */ |
||
74 | 55 | public function isCheckSum() |
|
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | 55 | public function getVersion() |
|
102 | |||
103 | /** |
||
104 | * File |
||
105 | * Position |
||
106 | * Binlog_Do_DB |
||
107 | * Binlog_Ignore_DB |
||
108 | * Executed_Gtid_Set |
||
109 | * |
||
110 | * @return array |
||
111 | */ |
||
112 | 55 | public function getMasterStatus() |
|
116 | } |