PHP Класс PMA\libraries\plugins\export\ExportSql

Наследование: extends PMA\libraries\plugins\ExportPlugin
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( ) Constructor
exportDBCreate ( string $db, string $export_type, string $db_alias = '' ) : boolean Outputs CREATE DATABASE statement
exportDBFooter ( string $db ) : boolean Outputs database footer
exportDBHeader ( string $db, string $db_alias = '' ) : boolean Outputs database header
exportData ( string $db, string $table, string $crlf, string $error_url, string $sql_query, array $aliases = [] ) : boolean Outputs the content of a table in SQL format
exportEvents ( string $db ) : boolean Exports events
exportFooter ( ) : boolean Outputs export footer
exportHeader ( ) : boolean Outputs export header. It is the first method to be called, so all the required variables are initialized here.
exportMetadata ( string $db, string | array $tables, array $metadataTypes ) : boolean Exports metadata from Configuration Storage
exportRoutines ( string $db, array $aliases = [] ) : boolean Exports routines (procedures and functions)
exportStructure ( string $db, string $table, string $crlf, string $error_url, string $export_mode, string $export_type, boolean $relation = false, boolean $comments = false, boolean $mime = false, boolean $dates = false, array $aliases = [] ) : boolean Outputs table's structure
getTableDef ( string $db, string $table, string $crlf, string $error_url, boolean $show_dates = false, boolean $add_semicolon = true, boolean $view = false, boolean $update_indexes_increments = true, array $aliases = [] ) : string Returns $table's CREATE definition
getTableDefStandIn ( string $db, string $view, string $crlf, array $aliases = [] ) : string Returns a stand-in CREATE definition to resolve view dependencies
replaceWithAliases ( string $sql_query, array $aliases, string $db, string $table = '', &$flag = null ) : string replaces db/table/column names with their aliases

Защищенные методы

Метод Описание
_exportRoutineSQL ( string $db, array $aliases, string $type, string $name, array $routines, string $delimiter ) : string Generates SQL for routines export
generateComment ( string $crlf, string $sql_statement, string $comment1, string $comment2, string $table_alias, string $compat ) : string Generate comment
setProperties ( ) : void Sets the export SQL properties

Приватные методы

Метод Описание
_exportComment ( string $text = '' ) : string Possibly outputs comment
_exportMetadata ( string $db, string $table, array $metadataTypes ) : boolean Exports metadata from Configuration Storage
_exportUseStatement ( string $db, string $compat ) : boolean Outputs USE statement
_getTableComments ( string $db, string $table, string $crlf, boolean $do_relation = false, boolean $do_mime = false, array $aliases = [] ) : string Returns $table's comments, relations etc.
_getTableDefForView ( string $db, string $view, string $crlf, boolean $add_semicolon = true, array $aliases = [] ) : string Returns CREATE definition that matches $view's structure
_makeCreateTableMSSQLCompatible ( string $create_query ) : string Make a create table statement compatible with MSSQL
_possibleCRLF ( ) : string Possibly outputs CRLF

Описание методов

__construct() публичный Метод

Constructor
public __construct ( )

_exportRoutineSQL() защищенный Метод

Generates SQL for routines export
protected _exportRoutineSQL ( string $db, array $aliases, string $type, string $name, array $routines, string $delimiter ) : string
$db string Database
$aliases array Aliases of db/table/columns
$type string Type of exported routine
$name string Verbose name of exported routine
$routines array List of routines to export
$delimiter string Delimiter to use in SQL
Результат string SQL query

exportDBCreate() публичный Метод

Outputs CREATE DATABASE statement
public exportDBCreate ( string $db, string $export_type, string $db_alias = '' ) : boolean
$db string Database name
$export_type string 'server', 'database', 'table'
$db_alias string Aliases of db
Результат boolean Whether it succeeded

exportDBFooter() публичный Метод

Outputs database footer
public exportDBFooter ( string $db ) : boolean
$db string Database name
Результат boolean Whether it succeeded

exportDBHeader() публичный Метод

Outputs database header
public exportDBHeader ( string $db, string $db_alias = '' ) : boolean
$db string Database name
$db_alias string Alias of db
Результат boolean Whether it succeeded

exportData() публичный Метод

Outputs the content of a table in SQL format
public exportData ( string $db, string $table, string $crlf, string $error_url, string $sql_query, array $aliases = [] ) : boolean
$db string database name
$table string table name
$crlf string the end of line sequence
$error_url string the url to go back in case of error
$sql_query string SQL query for obtaining data
$aliases array Aliases of db/table/columns
Результат boolean Whether it succeeded

exportEvents() публичный Метод

Exports events
public exportEvents ( string $db ) : boolean
$db string Database
Результат boolean Whether it succeeded

exportFooter() публичный Метод

Outputs export footer
public exportFooter ( ) : boolean
Результат boolean Whether it succeeded

exportHeader() публичный Метод

Outputs export header. It is the first method to be called, so all the required variables are initialized here.
public exportHeader ( ) : boolean
Результат boolean Whether it succeeded

exportMetadata() публичный Метод

Exports metadata from Configuration Storage
public exportMetadata ( string $db, string | array $tables, array $metadataTypes ) : boolean
$db string database being exported
$tables string | array table(s) being exported
$metadataTypes array types of metadata to export
Результат boolean Whether it succeeded

exportRoutines() публичный Метод

Exports routines (procedures and functions)
public exportRoutines ( string $db, array $aliases = [] ) : boolean
$db string Database
$aliases array Aliases of db/table/columns
Результат boolean Whether it succeeded

exportStructure() публичный Метод

Outputs table's structure
public exportStructure ( string $db, string $table, string $crlf, string $error_url, string $export_mode, string $export_type, boolean $relation = false, boolean $comments = false, boolean $mime = false, boolean $dates = false, array $aliases = [] ) : boolean
$db string database name
$table string table name
$crlf string the end of line sequence
$error_url string the url to go back in case of error
$export_mode string 'create_table','triggers','create_view', 'stand_in'
$export_type string 'server', 'database', 'table'
$relation boolean whether to include relation comments
$comments boolean whether to include the pmadb-style column comments as comments in the structure; this is deprecated but the parameter is left here because export.php calls exportStructure() also for other export types which use this parameter
$mime boolean whether to include mime comments
$dates boolean whether to include creation/update/check dates
$aliases array Aliases of db/table/columns
Результат boolean Whether it succeeded

generateComment() защищенный Метод

Generate comment
protected generateComment ( string $crlf, string $sql_statement, string $comment1, string $comment2, string $table_alias, string $compat ) : string
$crlf string Carriage return character
$sql_statement string SQL statement
$comment1 string Comment for dumped table
$comment2 string Comment for current table
$table_alias string Table alias
$compat string Compatibility mode
Результат string

getTableDef() публичный Метод

Returns $table's CREATE definition
public getTableDef ( string $db, string $table, string $crlf, string $error_url, boolean $show_dates = false, boolean $add_semicolon = true, boolean $view = false, boolean $update_indexes_increments = true, array $aliases = [] ) : string
$db string the database name
$table string the table name
$crlf string the end of line sequence
$error_url string the url to go back in case of error
$show_dates boolean whether to include creation/ update/check dates
$add_semicolon boolean whether to add semicolon and end-of-line at the end
$view boolean whether we're handling a view
$update_indexes_increments boolean whether we need to update two global variables
$aliases array Aliases of db/table/columns
Результат string resulting schema

getTableDefStandIn() публичный Метод

Returns a stand-in CREATE definition to resolve view dependencies
public getTableDefStandIn ( string $db, string $view, string $crlf, array $aliases = [] ) : string
$db string the database name
$view string the view name
$crlf string the end of line sequence
$aliases array Aliases of db/table/columns
Результат string resulting definition

replaceWithAliases() публичный Метод

replaces db/table/column names with their aliases
public replaceWithAliases ( string $sql_query, array $aliases, string $db, string $table = '', &$flag = null ) : string
$sql_query string SQL query in which aliases are to be substituted
$aliases array Alias information for db/table/column
$db string the database name
$table string the tablename
Результат string query replaced with aliases

setProperties() защищенный Метод

Sets the export SQL properties
protected setProperties ( ) : void
Результат void