Ejemplo n.º 1
0
 function toDialectString(IDialect $dialect)
 {
     //
     // FIXME move to IDialect
     //
     return 'DROP INDEX ' . $dialect->quoteIdentifier($this->index->getName()) . ($dialect->getDBDriver()->is(DBDriver::MYSQL) ? ' ON ' . $dialect->quoteIdentifier($this->index->getTable()->getName()) : '') . ($dialect->getDBDriver()->is(DBDriver::PGSQL) ? ' CASCADE ' : '') . ';';
 }
Ejemplo n.º 2
0
 /**
  * Adds a table index
  *
  * @param DBIndex $index index to add
  * @throws DuplicationException thrown when another index with the same name already added
  * @return DBTable itself
  */
 function addIndex(DBIndex $index)
 {
     $name = $index->getName();
     if ($name) {
         if (isset($this->indexes[$name])) {
             throw new DuplicationException('index', $name);
         }
     } else {
         $name = 'index_' . join('_', $index->getFields()) . (sizeof($this->indexes) + 1);
         $index->setName($name);
     }
     $this->indexes[$name] = $index;
     return $this;
 }
Ejemplo n.º 3
0
 function toDialectString(IDialect $dialect)
 {
     return 'CREATE ' . $this->index->toDialectString($dialect) . ';';
 }