Exemplo n.º 1
0
 /**
  * Builds the DDL SQL to drop an Index.
  *
  * @param      Index $index
  * @return     string
  */
 public function getDropIndexDDL(Index $index)
 {
     $pattern = "\nDROP INDEX %s ON %s;\n";
     return sprintf($pattern, $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()));
 }
Exemplo n.º 2
0
 /**
  * Builds the DDL SQL to add an Index.
  *
  * @param  Index  $index
  * @return string
  */
 public function getAddIndexDDL(Index $index)
 {
     // don't create index form primary key
     if ($this->getPrimaryKeyName($index->getTable()) == $this->quoteIdentifier($index->getName())) {
         return "";
     }
     $pattern = "\r\nCREATE %sINDEX %s ON %s (%s)%s;\r\n";
     return sprintf($pattern, $index->getIsUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()), $this->getColumnListDDL($index->getColumns()), $this->generateBlockStorage($index));
 }
 /**
  * Overrides the implementation from DefaultPlatform
  *
  * @author     Niklas Närhinen <*****@*****.**>
  * @return string
  * @see        DefaultPlatform::getDropIndexDDL
  */
 public function getDropIndexDDL(Index $index)
 {
     if ($index instanceof Unique) {
         $pattern = "\n    ALTER TABLE %s DROP CONSTRAINT %s;\n    ";
         return sprintf($pattern, $this->quoteIdentifier($index->getTable()->getName()), $this->quoteIdentifier($index->getName()));
     } else {
         return parent::getDropIndexDDL($index);
     }
 }
Exemplo n.º 4
0
 /**
  * Builds the DDL SQL to add an Index.
  *
  * @param      Index $index
  * @return     string
  */
 public function getAddIndexDDL(Index $index)
 {
     $pattern = "\nCREATE %sINDEX %s ON %s (%s);\n";
     return sprintf($pattern, $index->getIsUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()), $this->getColumnListDDL($index->getColumns()));
 }