class Relation (View source)

Set of functions used with the relation and PDF feature

Properties

DatabaseInterface $dbi

Methods

__construct(DatabaseInterface $dbi)

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 = '', string $source = 'both')

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

string|false
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

array
getDbComments()

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 $disp_row, string $foreign_field, string $foreign_display, string $data, int|null $max = null)

Outputs dropdown with values of foreign fields

array
getForeignData(array|bool $foreigners, string $field, bool $override_total, string $foreign_filter, string $foreign_limit, bool $get_total = false)

Gets foreign keys in preparation for a drop-down selector

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

Rename a field in relation tables

void
renameSingleTable(DatabaseName $configStorageDatabase, TableName $configStorageTable, string $source_db, string $target_db, string $source_table, string $target_table, string $db_field, string $table_field)

Performs SQL query used for renaming table.

void
renameTable(string $source_db, string $target_db, string $source_table, string $target_table)

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 $foreigners_full = null, array|null $child_references_full = 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
getDefaultPmaTableNames(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.

array
getRelationsAndStatus(bool $condition, string $db, string $table)

Gets the relations info and status, depending on the condition

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)

No description

Parameters

DatabaseInterface $dbi

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 = '', string $source = 'both')

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

string $source

the source for foreign key information

Return Value

array db,table,column

string|false 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|false

field name or false

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

array getDbComments()

Gets the comment for a db

Return Value

array comments

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 $disp_row, string $foreign_field, string $foreign_display, string $data, int|null $max = null)

Outputs dropdown with values of foreign fields

Parameters

array $disp_row

array of the displayed row

string $foreign_field

the foreign field

string $foreign_display

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

array getForeignData(array|bool $foreigners, string $field, bool $override_total, string $foreign_filter, string $foreign_limit, bool $get_total = false)

Gets foreign keys in preparation for a drop-down selector

Parameters

array|bool $foreigners

array of the foreign keys

string $field

the foreign field name

bool $override_total

whether to override the total

string $foreign_filter

a possible filter

string $foreign_limit

a possible LIMIT clause

bool $get_total

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

Return Value

array

data about the foreign keys

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

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 $new_name

new field name

Return Value

void

void renameSingleTable(DatabaseName $configStorageDatabase, TableName $configStorageTable, string $source_db, string $target_db, string $source_table, string $target_table, string $db_field, string $table_field)

Performs SQL query used for renaming table.

Parameters

DatabaseName $configStorageDatabase
TableName $configStorageTable
string $source_db

Source database name

string $target_db

Target database name

string $source_table

Source table name

string $target_table

Target table name

string $db_field

Name of database field

string $table_field

Name of table field

Return Value

void

void renameTable(string $source_db, string $target_db, string $source_table, string $target_table)

Rename a table in relation tables

usually called after table has been moved

Parameters

string $source_db

Source database name

string $target_db

Target database name

string $source_table

Source table name

string $target_table

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 $foreigners_full = null, array|null $child_references_full = 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 $foreigners_full

foreigners array for the whole table.

array|null $child_references_full

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 getDefaultPmaTableNames(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

array getRelationsAndStatus(bool $condition, string $db, string $table)

Gets the relations info and status, depending on the condition

Parameters

bool $condition

whether to look for foreigners or not

string $db

database name

string $table

table name

Return Value

array

($res_rel, $have_rel)

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