class IndexManager in Drupal driver for SQL Server and SQL Azure 8
Same name and namespace in other branches
- 8.2 src/Indexes/IndexManager.php \Drupal\sqlsrv\Indexes\IndexManager
Default indexes to be deployed for CORE functionality.
Hierarchy
- class \Drupal\sqlsrv\Indexes\IndexManager
Expanded class hierarchy of IndexManager
1 file declares its use of IndexManager
- sqlsrv.install in ./
sqlsrv.install - Installation file for sqlsrv module.
File
- src/
Indexes/ IndexManager.php, line 10
Namespace
Drupal\sqlsrv\IndexesView source
class IndexManager {
/**
* Summary of $connection
*
* @var Connection
*/
private $connection;
/**
* Creates an instance of DefaultIndexes with a all defined indexes.
*
* @param Connection $connection
*/
public function __construct(Connection $connection) {
$this->connection = $connection;
}
/**
* Deploy all missing indexes.
*
* @throws \Exception
*
* @return void
*/
public function DeployNew() {
// Scan the Implementations folder
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Implementations';
$files = file_scan_directory($dir, '/.*\\.sql$/');
foreach ($files as $file) {
$index = new Index($file->uri);
$schema = $this->connection
->schema();
if (!$schema
->_ExistsIndex($index
->GetTable(), $index
->GetName())) {
try {
// TODO: Consider the need to prefix the tables...
$this->connection
->query($index
->GetCode());
} catch (\Exception $e) {
\Drupal::logger('MSSQL')
->notice("Could not deploy index {$index->GetName()} for table {$index->GetTable()}");
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
IndexManager:: |
private | property | Summary of $connection | |
IndexManager:: |
public | function | Deploy all missing indexes. | |
IndexManager:: |
public | function | Creates an instance of DefaultIndexes with a all defined indexes. |