indexName() public method

Builds the name for an index.
public indexName ( string $tableName, string | array $options = [] )
$tableName string A table name.
$options string | array Either a column name or index options: - column: (string|array) column name(s). - name: (string) the index name to fall back to if no column names specified.
Ejemplo n.º 1
0
 /**
  * Builds the name for an index.
  *
  * Cuts the index name to the maximum length of 30 characters limited by
  * Oracle.
  *
  * @param string $tableName      A table name.
  * @param string|array $options  Either a column name or index options:
  *                               - column: (string|array) column name(s).
  *                               - name: (string) the index name to fall
  *                                 back to if no column names specified.
  */
 public function indexName($tableName, $options = array())
 {
     $index = parent::indexName($tableName, $options);
     if (strlen($index) <= 30) {
         return $index;
     }
     if (isset($options['name']) && $index == $options['name']) {
         return $this->_truncate($index);
     }
     return substr('ind_' . $this->_truncate($tableName, 15) . '_' . hash('crc32', $index), 0, 30);
 }
Ejemplo n.º 2
0
 /**
  * Builds the name for an index.
  *
  * Cuts the index name to the maximum length of 64 characters limited by
  * MySQL.
  *
  * @param string $tableName      A table name.
  * @param string|array $options  Either a column name or index options:
  *                               - column: (string|array) column name(s).
  *                               - name: (string) the index name to fall
  *                                 back to if no column names specified.
  */
 public function indexName($tableName, $options = array())
 {
     return substr(parent::indexName($tableName, $options), 0, 64);
 }