src/bbn/db/languages/mysql.php
public function create_index(string $table, $column, bool $unique = false, $length = null): bool
	{
	  $column = (array)$column;
    if ( $length ){
      $length = (array)$length;
    }
    $name = bbn\str::encode_filename($table);
		if ( $table = $this->table_full_name($table, true) ){
      foreach ( $column as $i => $c ){
        if ( !bbn\str::check_name($c) ){
          $this->db->error("Illegal column $c");
        }
        $name .= '_'.$c;
        $column[$i] = $this->escape($column[$i]);
        if ( \is_int($length[$i]) && $length[$i] > 0 ){
          $column[$i] .= '('.$length[$i].')';
        }
      }
      $name = bbn\str::cut($name, 50);
			return (bool)$this->db->query('CREATE '.( $unique ? 'UNIQUE ' : '' )."INDEX `$name` ON $table ( ".
        implode(', ', $column).' )');
		}
		return false;
	}
public function create_index(string $table, $column, bool $unique = false, $length = null): bool
	{
	  $column = (array)$column;
    if ( $length ){
      $length = (array)$length;
    }
    $name = bbn\str::encode_filename($table);
		if ( $table = $this->table_full_name($table, true) ){
      foreach ( $column as $i => $c ){
        if ( !bbn\str::check_name($c) ){
          $this->db->error("Illegal column $c");
        }
        $name .= '_'.$c;
        $column[$i] = $this->escape($column[$i]);
        if ( \is_int($length[$i]) && $length[$i] > 0 ){
          $column[$i] .= '('.$length[$i].')';
        }
      }
      $name = bbn\str::cut($name, 50);
			return (bool)$this->db->query('CREATE '.( $unique ? 'UNIQUE ' : '' )."INDEX `$name` ON $table ( ".
        implode(', ', $column).' )');
		}
		return false;
	}
public function create_index ( string $ table , $ column , bool $ unique = false , $ length = null ) : bool { $ column = ( array ) $ column ; if ( $ length ) { $ length = ( array ) $ length ; } $ name = bbn \ str :: encode_filename ( $ table ) ; if ( $ table = $ this -> table_full_name ( $ table , true ) ) { foreach ( $ column as $ i => $ c ) { if ( ! bbn \ str :: check_name ( $ c ) ) { $ this -> db -> error ( "Illegal column $c" ) ; } $ name .= '_' . $ c ; $ column [ $ i ] = $ this -> escape ( $ column [ $ i ] ) ; if ( \ is_int ( $ length [ $ i ] ) && $ length [ $ i ] > 0 ) { $ column [ $ i ] .= '(' . $ length [ $ i ] . ')' ; } } $ name = bbn \ str :: cut ( $ name , 50 ) ; return ( bool ) $ this -> db -> query ( 'CREATE ' . ( $ unique ? 'UNIQUE ' : '' ) . "INDEX `$name` ON $table ( " . implode ( ', ' , $ column ) . ' )' ) ; } return false ; }
Creates an index

@param null|string $table
@param string|array $column
@param bool $unique
@param null $length
@return bool
Creates an index