You are here

class MySqlHandler in DB Maintenance 8

Same name and namespace in other branches
  1. 7.2 src/Module/Db/DbServer/MySql/MySqlHandler.php \Drupal\db_maintenance\Module\Db\DbServer\MySql\MySqlHandler
  2. 2.0.x src/Module/Db/DbServer/MySql/MySqlHandler.php \Drupal\db_maintenance\Module\Db\DbServer\MySql\MySqlHandler

MySqlHandler class.

Hierarchy

Expanded class hierarchy of MySqlHandler

1 file declares its use of MySqlHandler
DbServerHandlerFactory.php in src/Module/Db/DbServer/DbServerHandlerFactory.php
DbServerHandlerFactory class.

File

src/Module/Db/DbServer/MySql/MySqlHandler.php, line 15
MySqlHandler class.

Namespace

Drupal\db_maintenance\Module\Db\DbServer\MySql
View source
class MySqlHandler implements DbServerHandlerInterface {

  /**
   * Returns list of tables in the active database.
   */
  public function listTables() {
    $result = \Drupal::database()
      ->query("SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'", array(), array(
      'fetch' => \PDO::FETCH_ASSOC,
    ));
    return $result;
  }

  /**
   * Optimizes table in the active database.
   */
  public function optimizeTable($table_name) {
    try {
      \Drupal::database()
        ->query("OPTIMIZE TABLE {$table_name}")
        ->execute();
    } catch (\Exception $e) {
      watchdog_exception('type', $e);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MySqlHandler::listTables public function Returns list of tables in the active database. Overrides DbServerHandlerInterface::listTables
MySqlHandler::optimizeTable public function Optimizes table in the active database. Overrides DbServerHandlerInterface::optimizeTable