/**
  * Execute the command.
  *
  * @return  void
  *
  * @since   1.0
  * @throws  AbortException
  * @throws  \RuntimeException
  * @throws  \UnexpectedValueException
  */
 public function execute()
 {
     try {
         // Check if the database "exists"
         $tables = $this->db->getTableList();
         if (!$this->app->input->get('reinstall')) {
             $this->app->out('<fg=black;bg=yellow>WARNING: A database has been found !!</fg=black;bg=yellow>')->out('Do you want to reinstall ? [y]es / [[n]]o :', false);
             $in = trim($this->app->in());
             if (!in_array($in, ['yes', 'y'])) {
                 throw new AbortException();
             }
         }
         $this->cleanDatabase($tables);
         $this->app->out("\nFinished!");
     } catch (\RuntimeException $e) {
         // Check if the message is "Could not connect to database."  Odds are, this means the DB isn't there or the server is down.
         if (strpos($e->getMessage(), 'Could not connect to database.') !== false) {
             // ? really..
             $this->app->out('No database found.')->out('Creating the database...', false);
             $this->db->setQuery('CREATE DATABASE ' . $this->db->quoteName($this->config->get('database.name')))->execute();
             $this->db->select($this->config->get('database.name'));
             $this->app->out("\nFinished!");
         } else {
             throw $e;
         }
     }
     // Perform the installation
     $this->processSql();
     $this->app->out('Installer has terminated successfully.');
 }