@@ -180,35 +180,41 @@ private function assertSchema(PDO|Connection $raw): void
180180
181181 if ($ raw instanceof PDO ) {
182182 $ placeholders = implode (', ' , array_fill (0 , count ($ required ), '? ' ));
183- $ stmt = $ raw ->prepare (
184- 'SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES '
185- . 'WHERE TABLE_SCHEMA = DATABASE() '
186- . 'AND TABLE_NAME IN ( ' . $ placeholders . ') '
187- );
188-
189- /** @var mixed $stmt */
190- if ($ stmt !== false ) {
191- /** @var \PDOStatement $stmt */
192- $ stmt ->execute ($ required );
193-
194- /** @var mixed $fetcher */
195- $ fetcher = [$ stmt , 'fetchAll ' ];
196-
197- if (is_callable ($ fetcher )) {
198- /** @var array<int,string>|false $present */
199- $ present = $ fetcher (7 , 0 ); // 7 = \PDO::FETCH_COLUMN
200-
201- if (is_array ($ present )) {
202- $ normalized = array_map ('strtolower ' , $ present );
203- $ missing = array_values (array_diff ($ required , $ normalized ));
183+ /** @var mixed $preparer */
184+ $ preparer = [$ raw , 'prepare ' ];
185+
186+ if (is_callable ($ preparer )) {
187+ $ stmt = $ preparer (
188+ 'SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES '
189+ . 'WHERE TABLE_SCHEMA = DATABASE() '
190+ . 'AND TABLE_NAME IN ( ' . $ placeholders . ') '
191+ );
192+
193+ if ($ stmt !== false ) {
194+ /** @var \PDOStatement $stmt */
195+ $ stmt ->execute ($ required );
196+
197+ /** @var mixed $fetcher */
198+ $ fetcher = [$ stmt , 'fetchAll ' ];
199+
200+ if (is_callable ($ fetcher )) {
201+ /** @var array<int,string>|false $present */
202+ $ present = $ fetcher (7 , 0 ); // 7 = \PDO::FETCH_COLUMN
203+
204+ if (is_array ($ present )) {
205+ $ normalized = array_map ('strtolower ' , $ present );
206+ $ missing = array_values (array_diff ($ required , $ normalized ));
207+ } else {
208+ throw new \RuntimeException ('IntegrationV2 MySQL fetch failed. ' );
209+ }
204210 } else {
205- throw new \RuntimeException ('IntegrationV2 MySQL fetch failed . ' );
211+ throw new \RuntimeException ('IntegrationV2 MySQL fetchAll missing . ' );
206212 }
207213 } else {
208- throw new \RuntimeException ('IntegrationV2 MySQL fetchAll missing . ' );
214+ throw new \RuntimeException ('IntegrationV2 MySQL prepare failed . ' );
209215 }
210216 } else {
211- throw new \RuntimeException ('IntegrationV2 MySQL prepare failed . ' );
217+ throw new \RuntimeException ('IntegrationV2 MySQL prepare missing . ' );
212218 }
213219 } else {
214220 /** @var mixed $smGetter */
0 commit comments