Exemple #1
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 = "\nCREATE %sINDEX %s ON %s (%s)%s;\n";
     return sprintf($pattern, $index->getIsUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()), $this->getColumnListDDL($index->getColumns()), $this->generateBlockStorage($index));
 }
Exemple #2
0
 protected function getIndexType(Index $index)
 {
     $type = '';
     $vendorInfo = $index->getVendorInfoForType($this->getDatabaseType());
     if ($vendorInfo && $vendorInfo->getParameter('Index_type')) {
         $type = $vendorInfo->getParameter('Index_type') . ' ';
     } elseif ($index->getIsUnique()) {
         $type = 'UNIQUE ';
     }
     return $type;
 }
Exemple #3
0
 /**
  * Builds the DDL SQL for an Index object.
  *
  * @param      Index $index
  * @return     string
  */
 public function getIndexDDL(Index $index)
 {
     return sprintf('%sINDEX %s (%s)', $index->getIsUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->getColumnListDDL($index->getColumns()));
 }