code = $code; $this->driver = $driver; $this->errorInfo = $error_info ?? $this->create_error_info( $message, $code, $previous ); } /** * Get the MySQL-on-SQLite driver that originated the exception. * * @return WP_MySQL_On_SQLite The originating driver. */ public function get_driver(): WP_MySQL_On_SQLite { return $this->driver; } /** * Create PDO-style error information from an originating exception or from * the emulated driver error. * * @param string $message The exception message. * @param int|string $code The exception code. * @param Throwable|null $previous The previous throwable. * @return array PDO-style error information. */ private function create_error_info( string $message, $code, ?Throwable $previous ): array { if ( $previous instanceof PDOException && is_array( $previous->errorInfo ) ) { return $previous->errorInfo; } $sqlstate = is_string( $code ) && 5 === strlen( $code ) ? $code : 'HY000'; return array( $sqlstate, 1105, $message ); } }