コード例 #1
0
ファイル: MysqlAdapter.php プロジェクト: parkerj/eduTrac-SIS
 /**
  * Gets the MySQL Index Definition for an Index object.
  *
  * @param Index $index Index
  * @return string
  */
 protected function getIndexSqlDefinition(Index $index)
 {
     $def = '';
     $limit = '';
     if ($index->getLimit()) {
         $limit = '(' . $index->getLimit() . ')';
     }
     if ($index->getType() == Index::UNIQUE) {
         $def .= ' UNIQUE';
     }
     if ($index->getType() == Index::FULLTEXT) {
         $def .= ' FULLTEXT';
     }
     $def .= ' KEY';
     if (is_string($index->getName())) {
         $def .= ' `' . $index->getName() . '`';
     }
     $def .= ' (`' . implode('`,`', $index->getColumns()) . '`' . $limit . ')';
     return $def;
 }