class MySqlHandler in DB Maintenance 8
Same name and namespace in other branches
- 7.2 src/Module/Db/DbServer/MySql/MySqlHandler.php \Drupal\db_maintenance\Module\Db\DbServer\MySql\MySqlHandler
- 2.0.x src/Module/Db/DbServer/MySql/MySqlHandler.php \Drupal\db_maintenance\Module\Db\DbServer\MySql\MySqlHandler
MySqlHandler class.
Hierarchy
- class \Drupal\db_maintenance\Module\Db\DbServer\MySql\MySqlHandler implements DbServerHandlerInterface
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\MySqlView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MySqlHandler:: |
public | function |
Returns list of tables in the active database. Overrides DbServerHandlerInterface:: |
|
MySqlHandler:: |
public | function |
Optimizes table in the active database. Overrides DbServerHandlerInterface:: |