PHP 클래스 PMA\libraries\Table

파일 보기 프로젝트 열기: phpmyadmin/phpmyadmin 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$engine engine (innodb, myisam, bdb, ...)
$errors errors occurred
$messages messages
$type type (view, base table, system view)
$uiprefs UI preferences

보호된 프로퍼티들

프로퍼티 타입 설명
$_db_name database name
$_dbi DatabaseInterface
$_name table name

공개 메소드들

메소드 설명
__construct ( string $table_name, string $db_name, DatabaseInterface $dbi = null ) Constructor
__toString ( ) : string returns table name
checkIfMinRecordsExist ( integer $min_records ) : boolean Checks if the number of records in a table is at least equal to $min_records
countRecords ( boolean $force_exact = false ) : mixed Counts and returns (or displays) the number of records in a table
duplicateInfo ( string $work, string $pma_table, array $get_fields, array $where_fields, array $new_fields ) : integer | boolean Inserts existing entries in a PMA_* table by reading a value from an old entry
generateAlter ( string $oldcol, string $newcol, string $type, string $length, string $attribute, string $collation, boolean | string $null, string $default_type, string $default_value, string $extra, string $comment, string $virtuality, string $expression, string $move_to ) : string Generates column specification for ALTER syntax
generateFieldSpec ( string $name, string $type, string $length = '', string $attribute = '', string $collation = '', boolean | string $null = false, string $default_type = 'USER_DEFINED', string $default_value = '', string $extra = '', string $comment = '', string $virtuality = '', string $expression = '', string $move_to = '' ) : string generates column specification for ALTER or CREATE TABLE syntax
getColumnGenerationExpression ( string $column = null ) : array | boolean Returns the generation expression for virtual columns
getColumns ( boolean $backquoted = true, boolean $fullName = true ) : array Get all columns
getColumnsMeta ( ) : mixed Get meta info for fields in table
getColumnsWithIndex ( integer $types ) : array Get columns with indexes
getDbName ( boolean $backquoted = false ) : string returns database name for this table
getFullName ( boolean $backquoted = false ) : string returns full name for table, including database name
getIndex ( string $index ) : Index Get index with index name
getIndexedColumns ( boolean $backquoted = true, boolean $fullName = true ) : array Get all indexed columns
getLastError ( ) : string return the last error
getLastMessage ( ) : string return the last message
getName ( boolean $backquoted = false ) : string returns table name
getNameAndTypeOfTheColumns ( ) : array Function to get the name and type of the columns of a table
getNonGeneratedColumns ( boolean $backquoted = true ) : array Get non-generated columns in table
getRealRowCountTable ( ) : number Returns the real row count for a table
getReservedColumnNames ( ) : array Get all column names which are MySQL reserved words
getSqlQueryForIndexCreateOrEdit ( Index $index, &$error ) : string Function to get the sql query for index creation or edit
getStatusInfo ( string $info = null, boolean $force_read = false, boolean $disable_error = false ) : mixed Returns full table status info, or specific if $info provided this info is collected from information_schema
getUiProp ( string $property ) : mixed Get a property from UI preferences.
getUniqueColumns ( boolean $backquoted = true, boolean $fullName = true ) : array Get all unique columns
isEngine ( $engine ) : boolean Checks the storage engine used to create table
isMerge ( ) : boolean Checks if this is a merge table
isUpdatableView ( ) : boolean Returns whether the table is actually an updatable view
isValidName ( string $table_name, boolean $is_backquoted = false ) : boolean checks if given name is a valid table name, currently if not empty, trailing spaces, '.', '/' and '\'
isView ( ) : boolean returns whether the table is actually a view
moveCopy ( string $source_db, string $source_table, string $target_db, string $target_table, string $what, boolean $move, string $mode ) : boolean Copies or renames table
removeUiProp ( string $property ) : true | Message Remove a property from UI preferences.
rename ( string $new_name, string $new_db = null ) : boolean renames table
setUiProp ( string $property, mixed $value, string $table_create_time = null ) : boolean | Message Set a property from UI preferences.
showCreate ( ) : mixed Returns the CREATE statement for this table
updateDisplayField ( string $disp, string $display_field, array $cfgRelation ) : boolean Function to handle update for display field
updateForeignKeys ( array $destination_foreign_db, array $multi_edit_columns_name, array $destination_foreign_table, array $destination_foreign_column, array $options_array, string $table, array $existrel_foreign ) : array Function to handle foreign key updates
updateInternalRelations ( array $multi_edit_columns_name, array $destination_db, array $destination_table, array $destination_column, array $cfgRelation, array | null $existrel ) : boolean Function to get update query for updating internal relations

보호된 메소드들

메소드 설명
getUiPrefsFromDb ( ) : array Return UI preferences for this table from phpMyAdmin database.
loadUiPrefs ( ) : void Loads the UI preferences for this table.
saveUiPrefsToDb ( ) : true | Message Save this table's UI preferences into phpMyAdmin database.

비공개 메소드들

메소드 설명
_formatColumns ( array $indexed, boolean $backquoted, boolean $fullName ) : array Formats lists of columns
_getSQLToCreateForeignKey ( string $table, array $field, string $foreignDb, string $foreignTable, array $foreignField, string $name = null, string $onDelete = null, string $onUpdate = null ) : string Returns the SQL query for foreign key constraint creation

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( string $table_name, string $db_name, DatabaseInterface $dbi = null )
$table_name string table name
$db_name string database name
$dbi DatabaseInterface database interface for the table

__toString() 공개 메소드

returns table name
또한 보기: Table::getName()
public __toString ( ) : string
리턴 string table name

checkIfMinRecordsExist() 공개 메소드

Checks if the number of records in a table is at least equal to $min_records
public checkIfMinRecordsExist ( integer $min_records ) : boolean
$min_records integer Number of records to check for in a table
리턴 boolean True, if at least $min_records exist, False otherwise.

countRecords() 공개 메소드

Counts and returns (or displays) the number of records in a table
public countRecords ( boolean $force_exact = false ) : mixed
$force_exact boolean whether to force an exact count
리턴 mixed the number of records if "retain" param is true, otherwise true

duplicateInfo() 공개 정적인 메소드

Inserts existing entries in a PMA_* table by reading a value from an old entry
public static duplicateInfo ( string $work, string $pma_table, array $get_fields, array $where_fields, array $new_fields ) : integer | boolean
$work string The array index, which Relation feature to check ('relwork', 'commwork', ...)
$pma_table string The array index, which PMA-table to update ('bookmark', 'relation', ...)
$get_fields array Which fields will be SELECT'ed from the old entry
$where_fields array Which fields will be used for the WHERE query (array('FIELDNAME' => 'FIELDVALUE'))
$new_fields array Which fields will be used as new VALUES. These are the important keys which differ from the old entry (array('FIELDNAME' => 'NEW FIELDVALUE'))
리턴 integer | boolean

generateAlter() 공개 정적인 메소드

Generates column specification for ALTER syntax
또한 보기: Table::generateFieldSpec()
public static generateAlter ( string $oldcol, string $newcol, string $type, string $length, string $attribute, string $collation, boolean | string $null, string $default_type, string $default_value, string $extra, string $comment, string $virtuality, string $expression, string $move_to ) : string
$oldcol string old column name
$newcol string new column name
$type string type ('INT', 'VARCHAR', 'BIT', ...)
$length string length ('2', '5,2', '', ...)
$attribute string attribute
$collation string collation
$null boolean | string with 'NULL' or 'NOT NULL'
$default_type string whether default is CURRENT_TIMESTAMP, NULL, NONE, USER_DEFINED
$default_value string default value for USER_DEFINED default type
$extra string 'AUTO_INCREMENT'
$comment string field comment
$virtuality string virtuality of the column
$expression string expression for the virtual column
$move_to string new position for column
리턴 string field specification

generateFieldSpec() 정적인 공개 메소드

generates column specification for ALTER or CREATE TABLE syntax
static public generateFieldSpec ( string $name, string $type, string $length = '', string $attribute = '', string $collation = '', boolean | string $null = false, string $default_type = 'USER_DEFINED', string $default_value = '', string $extra = '', string $comment = '', string $virtuality = '', string $expression = '', string $move_to = '' ) : string
$name string name
$type string type ('INT', 'VARCHAR', 'BIT', ...)
$length string length ('2', '5,2', '', ...)
$attribute string attribute
$collation string collation
$null boolean | string with 'NULL' or 'NOT NULL'
$default_type string whether default is CURRENT_TIMESTAMP, NULL, NONE, USER_DEFINED
$default_value string default value for USER_DEFINED default type
$extra string 'AUTO_INCREMENT'
$comment string field comment
$virtuality string virtuality of the column
$expression string expression for the virtual column
$move_to string new position for column
리턴 string field specification

getColumnGenerationExpression() 공개 메소드

Returns the generation expression for virtual columns
public getColumnGenerationExpression ( string $column = null ) : array | boolean
$column string name of the column
리턴 array | boolean associative array of column name and their expressions or false on failure

getColumns() 공개 메소드

returns an array with all columns
public getColumns ( boolean $backquoted = true, boolean $fullName = true ) : array
$backquoted boolean whether to quote name with backticks ``
$fullName boolean whether to include full name of the table as a prefix
리턴 array

getColumnsMeta() 공개 메소드

Get meta info for fields in table
public getColumnsMeta ( ) : mixed
리턴 mixed

getColumnsWithIndex() 공개 메소드

Get columns with indexes
public getColumnsWithIndex ( integer $types ) : array
$types integer types bitmask
리턴 array an array of columns

getDbName() 공개 메소드

returns database name for this table
public getDbName ( boolean $backquoted = false ) : string
$backquoted boolean whether to quote name with backticks ``
리턴 string database name for this table

getFullName() 공개 메소드

returns full name for table, including database name
public getFullName ( boolean $backquoted = false ) : string
$backquoted boolean whether to quote name with backticks ``
리턴 string

getIndex() 공개 메소드

Get index with index name
public getIndex ( string $index ) : Index
$index string Index name
리턴 Index

getIndexedColumns() 공개 메소드

returns an array with all columns that make use of an index e.g. index(col1, col2) would return col1, col2
public getIndexedColumns ( boolean $backquoted = true, boolean $fullName = true ) : array
$backquoted boolean whether to quote name with backticks ``
$fullName boolean whether to include full name of the table as a prefix
리턴 array

getLastError() 공개 메소드

return the last error
public getLastError ( ) : string
리턴 string the last error

getLastMessage() 공개 메소드

return the last message
public getLastMessage ( ) : string
리턴 string the last message

getName() 공개 메소드

returns table name
public getName ( boolean $backquoted = false ) : string
$backquoted boolean whether to quote name with backticks ``
리턴 string table name

getNameAndTypeOfTheColumns() 공개 메소드

Function to get the name and type of the columns of a table
public getNameAndTypeOfTheColumns ( ) : array
리턴 array

getNonGeneratedColumns() 공개 메소드

Get non-generated columns in table
public getNonGeneratedColumns ( boolean $backquoted = true ) : array
$backquoted boolean whether to quote name with backticks ``
리턴 array

getRealRowCountTable() 공개 메소드

Returns the real row count for a table
public getRealRowCountTable ( ) : number
리턴 number

getReservedColumnNames() 공개 메소드

Get all column names which are MySQL reserved words
public getReservedColumnNames ( ) : array
리턴 array

getSqlQueryForIndexCreateOrEdit() 공개 메소드

Function to get the sql query for index creation or edit
public getSqlQueryForIndexCreateOrEdit ( Index $index, &$error ) : string
$index Index current index
리턴 string

getStatusInfo() 공개 메소드

Returns full table status info, or specific if $info provided this info is collected from information_schema
public getStatusInfo ( string $info = null, boolean $force_read = false, boolean $disable_error = false ) : mixed
$info string specific information to be fetched
$force_read boolean read new rather than serving from cache
$disable_error boolean if true, disables error message
리턴 mixed

getUiPrefsFromDb() 보호된 메소드

Return UI preferences for this table from phpMyAdmin database.
protected getUiPrefsFromDb ( ) : array
리턴 array

getUiProp() 공개 메소드

Return false if the property is not found. Available property: - PROP_SORTED_COLUMN - PROP_COLUMN_ORDER - PROP_COLUMN_VISIB
public getUiProp ( string $property ) : mixed
$property string property
리턴 mixed

getUniqueColumns() 공개 메소드

returns an array with all columns with unique content, in fact these are all columns being single indexed in PRIMARY or UNIQUE e.g. - PRIMARY(id) // id - UNIQUE(name) // name - PRIMARY(fk_id1, fk_id2) // NONE - UNIQUE(x,y) // NONE
public getUniqueColumns ( boolean $backquoted = true, boolean $fullName = true ) : array
$backquoted boolean whether to quote name with backticks ``
$fullName boolean whether to include full name of the table as a prefix
리턴 array

isEngine() 공개 메소드

Checks the storage engine used to create table
public isEngine ( $engine ) : boolean
리턴 boolean True, if $engine matches the storage engine for the table, False otherwise.

isMerge() 공개 메소드

If the ENGINE of the table is MERGE or MRG_MYISAM (alias), this is a merge table.
public isMerge ( ) : boolean
리턴 boolean true if it is a merge table

isUpdatableView() 공개 메소드

Returns whether the table is actually an updatable view
public isUpdatableView ( ) : boolean
리턴 boolean whether the given is an updatable view

isValidName() 정적인 공개 메소드

checks if given name is a valid table name, currently if not empty, trailing spaces, '.', '/' and '\'
또한 보기: https://dev.mysql.com/doc/refman/5.0/en/legal-names.html
static public isValidName ( string $table_name, boolean $is_backquoted = false ) : boolean
$table_name string name to check
$is_backquoted boolean whether this name is used inside backquotes or not
리턴 boolean whether the string is valid or not

isView() 공개 메소드

returns whether the table is actually a view
public isView ( ) : boolean
리턴 boolean whether the given is a view

loadUiPrefs() 보호된 메소드

If pmadb and table_uiprefs is set, it will load the UI preferences from phpMyAdmin database.
protected loadUiPrefs ( ) : void
리턴 void

moveCopy() 공개 정적인 메소드

Copies or renames table
public static moveCopy ( string $source_db, string $source_table, string $target_db, string $target_table, string $what, boolean $move, string $mode ) : boolean
$source_db string source database
$source_table string source table
$target_db string target database
$target_table string target table
$what string what to be moved or copied (data, dataonly)
$move boolean whether to move
$mode string mode
리턴 boolean true if success, false otherwise

removeUiProp() 공개 메소드

Remove a property from UI preferences.
public removeUiProp ( string $property ) : true | Message
$property string the property
리턴 true | Message

rename() 공개 메소드

renames table
public rename ( string $new_name, string $new_db = null ) : boolean
$new_name string new table name
$new_db string new database name
리턴 boolean success

saveUiPrefsToDb() 보호된 메소드

Save this table's UI preferences into phpMyAdmin database.
protected saveUiPrefsToDb ( ) : true | Message
리턴 true | Message

setUiProp() 공개 메소드

If pmadb and table_uiprefs is set, it will save the UI preferences to phpMyAdmin database. Available property: - PROP_SORTED_COLUMN - PROP_COLUMN_ORDER - PROP_COLUMN_VISIB
public setUiProp ( string $property, mixed $value, string $table_create_time = null ) : boolean | Message
$property string Property
$value mixed Value for the property
$table_create_time string Needed for PROP_COLUMN_ORDER and PROP_COLUMN_VISIB
리턴 boolean | Message

showCreate() 공개 메소드

Returns the CREATE statement for this table
public showCreate ( ) : mixed
리턴 mixed

updateDisplayField() 공개 메소드

Function to handle update for display field
public updateDisplayField ( string $disp, string $display_field, array $cfgRelation ) : boolean
$disp string current display field
$display_field string display field
$cfgRelation array configuration relation
리턴 boolean True on update succeed or False on failure

updateForeignKeys() 공개 메소드

Function to handle foreign key updates
public updateForeignKeys ( array $destination_foreign_db, array $multi_edit_columns_name, array $destination_foreign_table, array $destination_foreign_column, array $options_array, string $table, array $existrel_foreign ) : array
$destination_foreign_db array destination foreign database
$multi_edit_columns_name array multi edit column names
$destination_foreign_table array destination foreign table
$destination_foreign_column array destination foreign column
$options_array array options array
$table string current table
$existrel_foreign array db, table, column
리턴 array

updateInternalRelations() 공개 메소드

Function to get update query for updating internal relations
public updateInternalRelations ( array $multi_edit_columns_name, array $destination_db, array $destination_table, array $destination_column, array $cfgRelation, array | null $existrel ) : boolean
$multi_edit_columns_name array multi edit column names
$destination_db array destination tables
$destination_table array destination tables
$destination_column array destination columns
$cfgRelation array configuration relation
$existrel array | null db, table, column
리턴 boolean

프로퍼티 상세

$_db_name 보호되어 있는 프로퍼티

database name
protected $_db_name

$_dbi 보호되어 있는 프로퍼티

protected DatabaseInterface,PMA\libraries $_dbi
리턴 DatabaseInterface

$_name 보호되어 있는 프로퍼티

table name
protected $_name

$engine 공개적으로 프로퍼티

engine (innodb, myisam, bdb, ...)
public $engine

$errors 공개적으로 프로퍼티

errors occurred
public $errors

$messages 공개적으로 프로퍼티

messages
public $messages

$type 공개적으로 프로퍼티

type (view, base table, system view)
public $type

$uiprefs 공개적으로 프로퍼티

UI preferences
public $uiprefs