protected function dumpEvents()
    {
        if ($this->config->events === true && version_compare($this->version, '5.1.12') >= 0) {
            $events = $this->pdo->prepare('SHOW EVENTS');
            $events->execute();

            foreach ($events->fetchAll(\PDO::FETCH_ASSOC) as $a) {
                $event = $a['Name'];

                if (in_array($event, (array) $this->config->ignore, true)) {
                    continue;
                }

                if ((string) $this->config->prefix !== '' && strpos($event, $this->config->prefix) !== 0) {
                    continue;
                }

                $structure = $this->pdo->query('SHOW CREATE EVENT `'.$event.'`');

                if ($structure = $structure->fetch(\PDO::FETCH_ASSOC)) {
                    if (isset($structure['Create Event'])) {
                        $query = $structure['Create Event'];
                        $delimiter = $this->getDelimiter('//', $query);
                        $this->write("\n-- Structure for event `{$event}`\n", false);
                        $this->write('DROP EVENT IF EXISTS `'.$event.'`');
                        $this->write("DELIMITER {$delimiter}\n{$query}\n{$delimiter}\nDELIMITER ;", false);
                    }
                }
            }
        }
    }