1 | <?php |
||
11 | class MySqlConnector extends Connector |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * Establish a database connection. |
||
16 | * |
||
17 | * @param array $config |
||
18 | * @return \PDO |
||
19 | */ |
||
20 | public function connect(array $config) |
||
48 | |||
49 | /** |
||
50 | * Set the connection transaction isolation level. |
||
51 | * |
||
52 | * @param \PDO $connection |
||
53 | * @param array $config |
||
54 | * @return void |
||
55 | */ |
||
56 | protected function configureIsolationLevel($connection, array $config) |
||
66 | |||
67 | |||
68 | /** |
||
69 | * Set the connection character set and collation. |
||
70 | * |
||
71 | * @param \PDO $connection |
||
72 | * @param array $config |
||
73 | * @return void|\PDO |
||
74 | */ |
||
75 | protected function configureEncoding($connection, array $config) |
||
85 | |||
86 | /** |
||
87 | * Get the collation for the configuration. |
||
88 | * |
||
89 | * @param array $config |
||
90 | * @return string |
||
91 | */ |
||
92 | protected function getCollation(array $config) |
||
96 | |||
97 | /** |
||
98 | * Set the timezone on the connection. |
||
99 | * |
||
100 | * @param \PDO $connection |
||
101 | * @param array $config |
||
102 | * @return void |
||
103 | */ |
||
104 | protected function configureTimezone($connection, array $config) |
||
110 | |||
111 | /** |
||
112 | * Create a DSN string from a configuration. |
||
113 | * |
||
114 | * Chooses socket or host/port based on the 'unix_socket' config value. |
||
115 | * |
||
116 | * @param array $config |
||
117 | * @return string |
||
118 | */ |
||
119 | protected function getDsn(array $config) |
||
125 | |||
126 | /** |
||
127 | * Determine if the given configuration array has a UNIX socket value. |
||
128 | * |
||
129 | * @param array $config |
||
130 | * @return bool |
||
131 | */ |
||
132 | protected function hasSocket(array $config) |
||
136 | |||
137 | /** |
||
138 | * Get the DSN string for a socket configuration. |
||
139 | * |
||
140 | * @param array $config |
||
141 | * @return string |
||
142 | */ |
||
143 | protected function getSocketDsn(array $config) |
||
147 | |||
148 | /** |
||
149 | * Get the DSN string for a host / port configuration. |
||
150 | * |
||
151 | * @param array $config |
||
152 | * @return string |
||
153 | */ |
||
154 | protected function getHostDsn(array $config) |
||
162 | |||
163 | /** |
||
164 | * Set the modes for the connection. |
||
165 | * |
||
166 | * @param \PDO $connection |
||
167 | * @param array $config |
||
168 | * @return void |
||
169 | */ |
||
170 | protected function setModes(PDO $connection, array $config) |
||
182 | |||
183 | /** |
||
184 | * Set the custom modes on the connection. |
||
185 | * |
||
186 | * @param \PDO $connection |
||
187 | * @param array $config |
||
188 | * @return void |
||
189 | */ |
||
190 | protected function setCustomModes(PDO $connection, array $config) |
||
196 | |||
197 | /** |
||
198 | * Get the query to enable strict mode. |
||
199 | * |
||
200 | * @param \PDO $connection |
||
201 | * @param array $config |
||
202 | * @return string |
||
203 | */ |
||
204 | protected function strictMode(PDO $connection, $config) |
||
214 | } |