PHP Class PMA\libraries\Index

Show file Open project: phpmyadmin/phpmyadmin Class Usage Examples

Public Methods

Method Description
__construct ( array $params = [] ) Constructor
addColumn ( array $params ) : void Add column to index
addColumns ( array $columns ) : void Adds a list of columns to the index
findDuplicates ( string $table, string $schema ) : string Function to check over array of indexes and look for common problems
generateIndexChoiceSelector ( boolean $edit_table ) : string Returns HTML for the index choice selector
generateIndexTypeSelector ( ) : string Returns HTML for the index type selector
getChoice ( ) : string Returns index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
getColumnCount ( ) : integer Returns the number of columns of the index
getColumns ( ) : PMA\libraries\IndexColumn[] Returns the columns of the index
getComment ( ) : string Returns the index comment
getComments ( ) : string Returns concatenated remarks and comment
getCompareData ( ) : array Gets the properties in an array for comparison purposes
getFromTable ( string $table, string $schema ) : Index[] returns an array with all indexes from the given table
getFromTableByChoice ( string $table, string $schema, integer $choices = 31 ) : Index[] Returns an array with all indexes from the given table of the requested types
getHtmlForIndexes ( string $table, string $schema, boolean $print_mode = false ) : string Show index data
getIndexChoices ( ) : string[] Return a list of all index choices
getIndexTypes ( ) : string[] Returns a lit of all index types
getKeyBlockSize ( ) : number Return the key block size
getName ( ) : string Returns the name of the index
getNonUnique ( ) : integer Returns integer 0 if the index cannot contain duplicates, 1 if it can
getPacked ( ) : string Returns how the index is packed
getParser ( ) : string Return the parser
getPrimary ( string $table, string $schema ) : mixed return primary if set, false otherwise
getRemarks ( ) : string Returns index remarks
getType ( ) : string Returns index type (BTREE, HASH, RTREE)
hasColumn ( string $column ) : boolean Returns true if $column indexed in this index
isPacked ( ) : string Returns 'No' if the index is not packed, how the index is packed if packed
isUnique ( boolean $as_text = false ) : mixed Returns whether the index is a 'Unique' index
set ( array $params ) : void Sets index details
setName ( string $name ) : void Sets the name of the index
singleton ( string $schema, string $table, string $index_name = '' ) : Index Creates(if not already created) and returns the corresponding Index object

Private Methods

Method Description
_loadIndexes ( string $table, string $schema ) : boolean Load index data for table

Method Details

__construct() public method

Constructor
public __construct ( array $params = [] )
$params array parameters

addColumn() public method

Add column to index
public addColumn ( array $params ) : void
$params array column params
return void

addColumns() public method

Adds a list of columns to the index
public addColumns ( array $columns ) : void
$columns array array containing details about the columns
return void

findDuplicates() public static method

Function to check over array of indexes and look for common problems
public static findDuplicates ( string $table, string $schema ) : string
$table string table name
$schema string schema name
return string Output HTML

generateIndexChoiceSelector() public method

Returns HTML for the index choice selector
public generateIndexChoiceSelector ( boolean $edit_table ) : string
$edit_table boolean whether this is table editing
return string HTML for the index choice selector

generateIndexTypeSelector() public method

Returns HTML for the index type selector
public generateIndexTypeSelector ( ) : string
return string HTML for the index type selector

getChoice() public method

Returns index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
public getChoice ( ) : string
return string index choice

getColumnCount() public method

Returns the number of columns of the index
public getColumnCount ( ) : integer
return integer the number of the columns

getColumns() public method

Returns the columns of the index
public getColumns ( ) : PMA\libraries\IndexColumn[]
return PMA\libraries\IndexColumn[] the columns of the index

getComment() public method

Returns the index comment
public getComment ( ) : string
return string index comment

getComments() public method

Returns concatenated remarks and comment
public getComments ( ) : string
return string concatenated remarks and comment

getCompareData() public method

Gets the properties in an array for comparison purposes
public getCompareData ( ) : array
return array an array containing the properties of the index

getFromTable() public static method

returns an array with all indexes from the given table
public static getFromTable ( string $table, string $schema ) : Index[]
$table string table
$schema string schema
return Index[] array of indexes

getFromTableByChoice() public static method

Returns an array with all indexes from the given table of the requested types
public static getFromTableByChoice ( string $table, string $schema, integer $choices = 31 ) : Index[]
$table string table
$schema string schema
$choices integer choices
return Index[] array of indexes

getHtmlForIndexes() public static method

Show index data
public static getHtmlForIndexes ( string $table, string $schema, boolean $print_mode = false ) : string
$table string The table name
$schema string The schema name
$print_mode boolean Whether the output is for the print mode
return string HTML for showing index

getIndexChoices() public static method

Return a list of all index choices
public static getIndexChoices ( ) : string[]
return string[] index choices

getIndexTypes() public static method

Returns a lit of all index types
public static getIndexTypes ( ) : string[]
return string[] index types

getKeyBlockSize() public method

Return the key block size
public getKeyBlockSize ( ) : number
return number

getName() public method

Returns the name of the index
public getName ( ) : string
return string the name of the index

getNonUnique() public method

Returns integer 0 if the index cannot contain duplicates, 1 if it can
public getNonUnique ( ) : integer
return integer 0 if the index cannot contain duplicates, 1 if it can

getPacked() public method

Returns how the index is packed
public getPacked ( ) : string
return string how the index is packed

getParser() public method

Return the parser
public getParser ( ) : string
return string

getPrimary() public static method

return primary if set, false otherwise
public static getPrimary ( string $table, string $schema ) : mixed
$table string table
$schema string schema
return mixed primary index or false if no one exists

getRemarks() public method

Returns index remarks
public getRemarks ( ) : string
return string index remarks

getType() public method

Returns index type (BTREE, HASH, RTREE)
public getType ( ) : string
return string index type

hasColumn() public method

Returns true if $column indexed in this index
public hasColumn ( string $column ) : boolean
$column string the column
return boolean true if $column indexed in this index

isPacked() public method

Returns 'No' if the index is not packed, how the index is packed if packed
public isPacked ( ) : string
return string

isUnique() public method

Returns whether the index is a 'Unique' index
public isUnique ( boolean $as_text = false ) : mixed
$as_text boolean whether to output should be in text
return mixed whether the index is a 'Unique' index

set() public method

Sets index details
public set ( array $params ) : void
$params array index details
return void

setName() public method

Sets the name of the index
public setName ( string $name ) : void
$name string index name
return void

singleton() public static method

Creates(if not already created) and returns the corresponding Index object
public static singleton ( string $schema, string $table, string $index_name = '' ) : Index
$schema string database name
$table string table name
$index_name string index name
return Index corresponding Index object