createIndex() public méthode

Creates a portable index on a table.
public createIndex ( string $table, string $name, boolean $unique = false, array $cols = null ) : void
$table string The name of the table for the index.
$name string The name of the index.
$unique boolean Whether or not the index is unique.
$cols array The columns in the index. If empty, uses the $name parameters as the column name.
Résultat void
 /**
  * 
  * Creates the table and indexes in the database using $this->_table_cols
  * and $this->_index.
  * 
  * @return void
  * 
  */
 protected function _createTableAndIndexes()
 {
     /**
      * Create the table.
      */
     $this->_sql->createTable($this->_table_name, $this->_table_cols);
     /**
      * Create the indexes.
      */
     foreach ($this->_index as $name => $info) {
         try {
             // create this index
             $this->_sql->createIndex($this->_table_name, $info['name'], $info['type'] == 'unique', $info['cols']);
         } catch (Exception $e) {
             // cancel the whole deal.
             $this->_sql->dropTable($this->_table_name);
             throw $e;
         }
     }
 }