class Index (View source)

Index manipulation class

Constants

PRIMARY

UNIQUE

INDEX

SPATIAL

FULLTEXT

Methods

__construct(array $params = [])

No description

static Index
singleton(DatabaseInterface $dbi, string $schema, string $table, string $indexName = '')

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

static array
getFromTable(DatabaseInterface $dbi, string $table, string $schema)

returns an array with all indexes from the given table

static array
getFromTableByChoice(string $table, string $schema, int $choices = 31)

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

static Index|null
getPrimary(DatabaseInterface $dbi, string $table, string $schema)

No description

void
addColumn(array $params)

Add column to index

void
addColumns(array $columns)

Adds a list of columns to the index

bool
hasColumn(string $column)

Returns true if $column indexed in this index

void
set(array $params)

Sets index details

int
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 array
getIndexTypes()

Returns a lit of all index types

bool
hasPrimary()

No description

string|null
getPacked()

Returns how the index is packed

string
isPacked()

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

bool
getNonUnique()

Returns bool false if the index cannot contain duplicates, true if it can

string|bool
isUnique(bool $asText = 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

array
getColumns()

Returns the columns of the index

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

__construct(array $params = [])

No description

Parameters

array $params parameters

static Index singleton(DatabaseInterface $dbi, string $schema, string $table, string $indexName = '')

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

Parameters

DatabaseInterface $dbi
string $schema
string $table
string $indexName

Return Value

Index

corresponding Index object

static array getFromTable(DatabaseInterface $dbi, string $table, string $schema)

returns an array with all indexes from the given table

Parameters

DatabaseInterface $dbi
string $table
string $schema

Return Value

array

static array 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

array

array of indexes

static Index|null getPrimary(DatabaseInterface $dbi, string $table, string $schema)

No description

Parameters

DatabaseInterface $dbi
string $table
string $schema

Return Value

Index|null

void addColumn(array $params)

Add column to index

Parameters

array $params

column params

Return Value

void

void addColumns(array $columns)

Adds a list of columns to the index

Parameters

array $columns

array containing details about the columns

Return Value

void

bool hasColumn(string $column)

Returns true if $column indexed in this index

Parameters

string $column

the column

Return Value

bool

void set(array $params)

Sets index details

Parameters

array $params

index details

Return Value

void

int getColumnCount()

Returns the number of columns of the index

Return Value

int

the number of the columns

string getComment()

Returns the index comment

Return Value

string

index comment

string getRemarks()

Returns index remarks

Return Value

string

index remarks

int getKeyBlockSize()

Return the key block size

Return Value

int

string getParser()

Return the parser

Return Value

string

string getComments()

Returns concatenated remarks and comment

Return Value

string

concatenated remarks and comment

string getType()

Returns index type (BTREE, HASH, RTREE)

Return Value

string

index type

string getChoice()

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

Return Value

string

index choice

static array getIndexTypes()

Returns a lit of all index types

Return Value

array

index types

bool hasPrimary()

No description

Return Value

bool

string|null getPacked()

Returns how the index is packed

Return Value

string|null

how the index is packed

string isPacked()

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

Return Value

string

bool getNonUnique()

Returns bool false if the index cannot contain duplicates, true if it can

Return Value

bool

false if the index cannot contain duplicates, true if it can

string|bool isUnique(bool $asText = false)

Returns whether the index is a 'Unique' index

Parameters

bool $asText

whether to output should be in text

Return Value

string|bool

whether the index is a 'Unique' index

string getName()

Returns the name of the index

Return Value

string

the name of the index

void setName(string $name)

Sets the name of the index

Parameters

string $name

Return Value

void

array getColumns()

Returns the columns of the index

Return Value

array

array getCompareData()

Gets the properties in an array for comparison purposes

Return Value

array

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