class Relation (View source)

Set of functions used with the relation and PDF feature

Methods

__construct(DatabaseInterface $dbi, Config|null $config = null)

No description

bool
canAccessStorageTable(string $tableDbName)

Check if the table is accessible

bool
tryUpgradeTransformations()

Check whether column_info table input transformation upgrade is required and try to upgrade silently

array
getForeigners(string $db, string $table, string $column = '')

Gets all Relations to foreign tables for a given table or optionally a given column in a table

array
getForeignersInternal(string $db, string $table, string $column = '')

Gets all Relations to foreign tables for a given table or optionally a given column in a table

array
getForeignKeysData(string $db, string $table)

No description

string
getDisplayField(string $db, string $table)

Gets the display field of a table

array
getComments(string $db, string $table = '')

Gets the comments for all columns of a table or the db itself

string
getDbComment(string $db)

Gets the comment for a db

bool
setDbComment(string $db, string $comment = '')

Set a database comment to a certain value.

void
setHistory(string $db, string $table, string $username, string $sqlquery)

Set a SQL history entry

array|bool
getHistory(string $username)

Gets a SQL history entry

void
purgeHistory(string $username)

purges SQL history

array
buildForeignDropdown(array $foreign, string $data, string $mode)

Prepares the dropdown for one mode

string
foreignDropdown(array $dispRow, string $foreignField, string $foreignDisplay, string $data, int|null $max = null)

Outputs dropdown with values of foreign fields

getForeignData(array $foreigners, string $field, bool $overrideTotal, string $foreignFilter, string $foreignLimit, bool $getTotal = false)

Gets foreign keys in preparation for a drop-down selector

void
renameField(string $db, string $table, string $field, string $newName)

Rename a field in relation tables

void
renameSingleTable(DatabaseName $configStorageDatabase, TableName $configStorageTable, string $sourceDb, string $targetDb, string $sourceTable, string $targetTable, string $dbField, string $tableField)

Performs SQL query used for renaming table.

void
renameTable(string $sourceDb, string $targetDb, string $sourceTable, string $targetTable)

Rename a table in relation tables

int
createPage(string|null $newpage, PdfFeature $pdfFeature, string $db)

Create a PDF page

array
getChildReferences(string $db, string $table, string $column = '')

Get child table references for a table column.

array
checkChildForeignReferences(string $db, string $table, string $column, array|null $foreignersFull = null, array|null $childReferencesFull = null)

Check child table references and foreign key for a table column.

array|false
searchColumnInForeigners(array $foreigners, string $column)

Search a table column in foreign data.

array|false
getColumnFromForeignKeysData(array $foreignKeysData, string $column)

No description

array
getCreateTableSqlQueries(array $tableNameReplacements)

Returns default PMA table names and their create queries.

bool
createPmaDatabase(string $configurationStorageDbName)

Create a database to be used as configuration storage

void
fixPmaTables(string $db, bool $create = true)

Creates PMA tables in the given db, updates if already exists.

bool
arePmadbTablesAllDisabled()

Verifies that all pmadb features are disabled

bool
arePmadbTablesDefined()

Verifies if all the pmadb tables are defined

array
getTables(string $foreignDb, string $tblStorageEngine)

Get tables for foreign key constraint

string
void
initRelationParamsCache()

This function checks and initializes the phpMyAdmin configuration storage state before it is used into session cache.

Details

__construct(DatabaseInterface $dbi, Config|null $config = null)

No description

Parameters

DatabaseInterface $dbi
Config|null $config

RelationParameters getRelationParameters()

No description

Return Value

RelationParameters

bool canAccessStorageTable(string $tableDbName)

Check if the table is accessible

Parameters

string $tableDbName

The table or table.db

Return Value

bool

bool tryUpgradeTransformations()

Check whether column_info table input transformation upgrade is required and try to upgrade silently

Return Value

bool

array getForeigners(string $db, string $table, string $column = '')

Gets all Relations to foreign tables for a given table or optionally a given column in a table

Parameters

string $db

the name of the db to check for

string $table

the name of the table to check for

string $column

the name of the column to check for

Return Value

array

array getForeignersInternal(string $db, string $table, string $column = '')

Gets all Relations to foreign tables for a given table or optionally a given column in a table

Parameters

string $db
string $table
string $column

Return Value

array

array getForeignKeysData(string $db, string $table)

No description

Parameters

string $db
string $table

Return Value

array

string getDisplayField(string $db, string $table)

Gets the display field of a table

Parameters

string $db

the name of the db to check for

string $table

the name of the table to check for

Return Value

string

field name

array getComments(string $db, string $table = '')

Gets the comments for all columns of a table or the db itself

Parameters

string $db

the name of the db to check for

string $table

the name of the table to check for

Return Value

array

[column_name] = comment

string getDbComment(string $db)

Gets the comment for a db

Parameters

string $db

the name of the db to check for

Return Value

string

bool setDbComment(string $db, string $comment = '')

Set a database comment to a certain value.

Parameters

string $db

the name of the db

string $comment

the value of the column

Return Value

bool

void setHistory(string $db, string $table, string $username, string $sqlquery)

Set a SQL history entry

Parameters

string $db

the name of the db

string $table

the name of the table

string $username

the username

string $sqlquery

the sql query

Return Value

void

array|bool getHistory(string $username)

Gets a SQL history entry

Parameters

string $username

the username

Return Value

array|bool

list of history items

void purgeHistory(string $username)

purges SQL history

deletes entries that exceeds $cfg['QueryHistoryMax'], oldest first, for the given user

Parameters

string $username

the username

Return Value

void

array buildForeignDropdown(array $foreign, string $data, string $mode)

Prepares the dropdown for one mode

Parameters

array $foreign

the keys and values for foreigns

string $data

the current data of the dropdown

string $mode

the needed mode

Return Value

array

the

string foreignDropdown(array $dispRow, string $foreignField, string $foreignDisplay, string $data, int|null $max = null)

Outputs dropdown with values of foreign fields

Parameters

array $dispRow

array of the displayed row

string $foreignField

the foreign field

string $foreignDisplay

the foreign field to display

string $data

the current data of the dropdown (field in row)

int|null $max

maximum number of items in the dropdown

Return Value

string

the

ForeignData getForeignData(array $foreigners, string $field, bool $overrideTotal, string $foreignFilter, string $foreignLimit, bool $getTotal = false)

Gets foreign keys in preparation for a drop-down selector

Parameters

array $foreigners

array of the foreign keys

string $field

the foreign field name

bool $overrideTotal

whether to override the total

string $foreignFilter

a possible filter

string $foreignLimit

a possible LIMIT clause

bool $getTotal

optional, whether to get total num of rows in $foreignData['the_total;] (has an effect of performance)

Return Value

ForeignData

void renameField(string $db, string $table, string $field, string $newName)

Rename a field in relation tables

usually called after a column in a table was renamed

Parameters

string $db

database name

string $table

table name

string $field

old field name

string $newName

new field name

Return Value

void

void renameSingleTable(DatabaseName $configStorageDatabase, TableName $configStorageTable, string $sourceDb, string $targetDb, string $sourceTable, string $targetTable, string $dbField, string $tableField)

Performs SQL query used for renaming table.

Parameters

DatabaseName $configStorageDatabase
TableName $configStorageTable
string $sourceDb

Source database name

string $targetDb

Target database name

string $sourceTable

Source table name

string $targetTable

Target table name

string $dbField

Name of database field

string $tableField

Name of table field

Return Value

void

void renameTable(string $sourceDb, string $targetDb, string $sourceTable, string $targetTable)

Rename a table in relation tables

usually called after table has been moved

Parameters

string $sourceDb

Source database name

string $targetDb

Target database name

string $sourceTable

Source table name

string $targetTable

Target table name

Return Value

void

int createPage(string|null $newpage, PdfFeature $pdfFeature, string $db)

Create a PDF page

Parameters

string|null $newpage

name of the new PDF page

PdfFeature $pdfFeature
string $db

database name

Return Value

int

array getChildReferences(string $db, string $table, string $column = '')

Get child table references for a table column.

This works only if 'DisableIS' is false. An empty array is returned otherwise.

Parameters

string $db

name of master table db.

string $table

name of master table.

string $column

name of master table column.

Return Value

array

array checkChildForeignReferences(string $db, string $table, string $column, array|null $foreignersFull = null, array|null $childReferencesFull = null)

Check child table references and foreign key for a table column.

Parameters

string $db

name of master table db.

string $table

name of master table.

string $column

name of master table column.

array|null $foreignersFull

foreigners array for the whole table.

array|null $childReferencesFull

child references for the whole table.

Return Value

array

telling about references if foreign key.

array|false searchColumnInForeigners(array $foreigners, string $column)

Search a table column in foreign data.

Parameters

array $foreigners

Table Foreign data

string $column

Column name

Return Value

array|false

array|false getColumnFromForeignKeysData(array $foreignKeysData, string $column)

No description

Parameters

array $foreignKeysData
string $column

Return Value

array|false

array getCreateTableSqlQueries(array $tableNameReplacements)

Returns default PMA table names and their create queries.

Parameters

array $tableNameReplacements

Return Value

array

table name, create query

bool createPmaDatabase(string $configurationStorageDbName)

Create a database to be used as configuration storage

Parameters

string $configurationStorageDbName

Return Value

bool

void fixPmaTables(string $db, bool $create = true)

Creates PMA tables in the given db, updates if already exists.

Parameters

string $db database
bool $create

whether to create tables if they don't exist.

Return Value

void

bool arePmadbTablesAllDisabled()

Verifies that all pmadb features are disabled

Return Value

bool

bool arePmadbTablesDefined()

Verifies if all the pmadb tables are defined

Return Value

bool

array getTables(string $foreignDb, string $tblStorageEngine)

Get tables for foreign key constraint

Parameters

string $foreignDb

Database name

string $tblStorageEngine

Table storage engine

Return Value

array

Table names

string getConfigurationStorageDbName()

No description

Return Value

string

void initRelationParamsCache()

This function checks and initializes the phpMyAdmin configuration storage state before it is used into session cache.

Return Value

void