class Index

Index manipulation class

Constants

PRIMARY

UNIQUE

INDEX

SPATIAL

FULLTEXT

Methods

__construct(array $params = [])

Constructor

static Index
singleton(string $schema, string $table, string $index_name = '')

Creates(if not already created) and returns the corresponding Index object

static Index[]
getFromTable(string $table, string $schema)

returns an array with all indexes from the given table

static Index[]
getFromTableByChoice(string $table, string $schema, int $choices = 31)

Returns an array with all indexes from the given table of the requested types

static mixed
getPrimary(string $table, string $schema)

return primary if set, false otherwise

void
addColumn(array $params)

Add column to index

void
addColumns(array $columns)

Adds a list of columns to the index

boolean
hasColumn(string $column)

Returns true if $column indexed in this index

void
set(array $params)

Sets index details

integer
getColumnCount()

Returns the number of columns of the index

string
getComment()

Returns the index comment

string
getRemarks()

Returns index remarks

int
getKeyBlockSize()

Return the key block size

string
getParser()

Return the parser

string
getComments()

Returns concatenated remarks and comment

string
getType()

Returns index type (BTREE, HASH, RTREE)

string
getChoice()

Returns index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)

static string[]
getIndexChoices()

Return a list of all index choices

static string[]
getIndexTypes()

Returns a lit of all index types

string
generateIndexChoiceSelector(boolean $edit_table)

Returns HTML for the index choice selector

string
generateIndexTypeSelector()

Returns HTML for the index type selector

string
getPacked()

Returns how the index is packed

string
isPacked()

Returns 'No' if the index is not packed, how the index is packed if packed

integer
getNonUnique()

Returns integer 0 if the index cannot contain duplicates, 1 if it can

mixed
isUnique(boolean $as_text = false)

Returns whether the index is a 'Unique' index

string
getName()

Returns the name of the index

void
setName(string $name)

Sets the name of the index

getColumns()

Returns the columns of the index

static string
getHtmlForDisplayIndexes()

Get HTML for display indexes

static string
getHtmlForIndexes(string $table, string $schema, boolean $print_mode = false)

Show index data

array
getCompareData()

Gets the properties in an array for comparison purposes

static string
findDuplicates(string $table, string $schema)

Function to check over array of indexes and look for common problems

Details

at line 114
__construct(array $params = [])

Constructor

Parameters

array $params parameters

at line 128
static Index singleton(string $schema, string $table, string $index_name = '')

Creates(if not already created) and returns the corresponding Index object

Parameters

string $schema database name
string $table table name
string $index_name index name

Return Value

Index corresponding Index object

at line 151
static Index[] getFromTable(string $table, string $schema)

returns an array with all indexes from the given table

Parameters

string $table table
string $schema schema

Return Value

Index[] array of indexes

at line 171
static Index[] getFromTableByChoice(string $table, string $schema, int $choices = 31)

Returns an array with all indexes from the given table of the requested types

Parameters

string $table table
string $schema schema
int $choices choices

Return Value

Index[] array of indexes

at line 212
static mixed getPrimary(string $table, string $schema)

return primary if set, false otherwise

Parameters

string $table table
string $schema schema

Return Value

mixed primary index or false if no one exists

at line 261
void addColumn(array $params)

Add column to index

Parameters

array $params column params

Return Value

void

at line 277
void addColumns(array $columns)

Adds a list of columns to the index

Parameters

array $columns array containing details about the columns

Return Value

void

at line 313
boolean hasColumn(string $column)

Returns true if $column indexed in this index

Parameters

string $column the column

Return Value

boolean true if $column indexed in this index

at line 325
void set(array $params)

Sets index details

Parameters

array $params index details

Return Value

void

at line 382
integer getColumnCount()

Returns the number of columns of the index

Return Value

integer the number of the columns

at line 392
string getComment()

Returns the index comment

Return Value

string index comment

at line 402
string getRemarks()

Returns index remarks

Return Value

string index remarks

at line 412
int getKeyBlockSize()

Return the key block size

Return Value

int

at line 422
string getParser()

Return the parser

Return Value

string

at line 432
string getComments()

Returns concatenated remarks and comment

Return Value

string concatenated remarks and comment

at line 448
string getType()

Returns index type (BTREE, HASH, RTREE)

Return Value

string index type

at line 458
string getChoice()

Returns index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)

Return Value

string index choice

at line 468
static string[] getIndexChoices()

Return a list of all index choices

Return Value

string[] index choices

at line 484
static string[] getIndexTypes()

Returns a lit of all index types

Return Value

string[] index types

at line 499
string generateIndexChoiceSelector(boolean $edit_table)

Returns HTML for the index choice selector

Parameters

boolean $edit_table whether this is table editing

Return Value

string HTML for the index choice selector

at line 529
string generateIndexTypeSelector()

Returns HTML for the index type selector

Return Value

string HTML for the index type selector

at line 549
string getPacked()

Returns how the index is packed

Return Value

string how the index is packed

at line 560
string isPacked()

Returns 'No' if the index is not packed, how the index is packed if packed

Return Value

string

at line 574
integer getNonUnique()

Returns integer 0 if the index cannot contain duplicates, 1 if it can

Return Value

integer 0 if the index cannot contain duplicates, 1 if it can

at line 586
mixed isUnique(boolean $as_text = false)

Returns whether the index is a 'Unique' index

Parameters

boolean $as_text whether to output should be in text

Return Value

mixed whether the index is a 'Unique' index

at line 608
string getName()

Returns the name of the index

Return Value

string the name of the index

at line 620
void setName(string $name)

Sets the name of the index

Parameters

string $name index name

Return Value

void

at line 630
IndexColumn[] getColumns()

Returns the columns of the index

Return Value

IndexColumn[] the columns of the index

at line 640
static string getHtmlForDisplayIndexes()

Get HTML for display indexes

Return Value

string

at line 680
static string getHtmlForIndexes(string $table, string $schema, boolean $print_mode = false)

Show index data

Parameters

string $table The table name
string $schema The schema name
boolean $print_mode Whether the output is for the print mode

Return Value

string HTML for showing index

at line 835
array getCompareData()

Gets the properties in an array for comparison purposes

Return Value

array an array containing the properties of the index

at line 859
static string findDuplicates(string $table, string $schema)

Function to check over array of indexes and look for common problems

Parameters

string $table table name
string $schema schema name

Return Value

string Output HTML