You are here

class Index in Drupal driver for SQL Server and SQL Azure 8

Same name and namespace in other branches
  1. 8.2 src/Indexes/Index.php \Drupal\sqlsrv\Indexes\Index

Represents a database Index.

Hierarchy

  • class \Drupal\sqlsrv\Indexes\Index

Expanded class hierarchy of Index

File

src/Indexes/Index.php, line 8

Namespace

Drupal\sqlsrv\Indexes
View source
class Index {
  private $table;
  private $name;
  private $code;

  /**
   * Create an instance of Index.
   *
   * @param mixed $uri
   * @throws \Exception
   */
  public function __construct($uri) {
    $name = pathinfo($uri, PATHINFO_FILENAME);
    $parts = explode('@', basename($name));
    if (count($parts) != 2) {
      throw new \Exception('Incorrect SQL index file name format.');
    }
    $this->table = $parts[0];
    $this->name = $parts[1];
    $this->code = file_get_contents($uri);
  }

  /**
   * Table name.
   *
   * @return string
   */
  public function GetTable() {
    return $this->table;
  }

  /**
   * Index name.
   *
   * @return string
   */
  public function GetName() {
    return $this->name;
  }

  /**
   * Get the SQL statement to create this index.
   *
   * @return string
   */
  public function GetCode() {
    return $this->code;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Index::$code private property
Index::$name private property
Index::$table private property
Index::GetCode public function Get the SQL statement to create this index.
Index::GetName public function Index name.
Index::GetTable public function Table name.
Index::__construct public function Create an instance of Index.