PHP Класс Ifsnop\Mysqldump\Mysqldump

Автор: Michael J. Calkins ([email protected])
Автор: Diego Torres ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$dsn string Connection string for PDO
$fileName string Destination filename, defaults to stdout
$pass string Database password
$user string Database username

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

Метод Описание
__construct ( string $dsn = '', string $user = '', string $pass = '', array $dumpSettings = [], array $pdoSettings = [] ) Constructor of Mysqldump. Note that in the case of an SQLite database connection, the filename must be in the $db parameter.
__destruct ( ) Destructor of Mysqldump. Unsets dbHandlers and database objects.
array_replace_recursive ( array $array1, array $array2 ) : array Custom array_replace_recursive to be used if PHP < 5.3 Replaces elements from passed arrays into the first array recursively
createStandInTable ( string $viewName ) : string Write a create table statement for the table Stand-In, show create table would return a create algorithm when used on a view
endListValues ( string $tableName ) : null Table rows extractor, close locks and commits after dump
getColumnStmt ( string $tableName ) : string Build SQL List of all columns on current table
prepareListValues ( string $tableName ) : null Table rows extractor, append information prior to dump
start ( string $filename = '' ) : null Main call

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

Метод Описание
connect ( ) : null Connect with PDO
escape ( string $tableName, array $row ) : string Escape values with quotes when needed
exportProcedures ( ) : null Exports all the procedures found in database
exportTables ( ) : null Exports all the tables selected from database
exportTriggers ( ) : null Exports all the triggers found in database
exportViews ( ) : null Exports all the views found in database
getDatabaseStructure ( ) : null Reads table and views names from database.
getDumpFileFooter ( ) : string Returns footer for dump file
getDumpFileHeader ( ) : string Returns header for dump file
getProcedureStructure ( string $procedureName ) : null Procedure structure extractor
getTableColumnTypes ( string $tableName ) : array Store column types to create data dumps and for Stand-In tables
getTableStructure ( string $tableName ) : null Table structure extractor
getTriggerStructure ( string $triggerName ) : null Trigger structure extractor
getViewStructureTable ( string $viewName ) : null View structure extractor, create table (avoids cyclic references)
getViewStructureView ( string $viewName ) : null View structure extractor, create view
listValues ( string $tableName ) : null Table rows extractor
matches ( $table, $arr ) : boolean Compare if $table name matches with a definition inside $arr
parseDsn ( string $dsn ) Parse DSN string and extract dbname value Several examples of a DSN string mysql:host=localhost;dbname=testdb mysql:host=localhost;port=3307;dbname=testdb mysql:unix_socket=/tmp/mysql.sock;dbname=testdb

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

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

Constructor of Mysqldump. Note that in the case of an SQLite database connection, the filename must be in the $db parameter.
public __construct ( string $dsn = '', string $user = '', string $pass = '', array $dumpSettings = [], array $pdoSettings = [] )
$dsn string PDO DSN connection string
$user string SQL account username
$pass string SQL account password
$dumpSettings array SQL database settings
$pdoSettings array PDO configured attributes

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

Destructor of Mysqldump. Unsets dbHandlers and database objects.
public __destruct ( )

array_replace_recursive() публичный статический Метод

Custom array_replace_recursive to be used if PHP < 5.3 Replaces elements from passed arrays into the first array recursively
public static array_replace_recursive ( array $array1, array $array2 ) : array
$array1 array The array in which elements are replaced
$array2 array The array from which elements will be extracted
Результат array Returns an array, or NULL if an error occurs.

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

Write a create table statement for the table Stand-In, show create table would return a create algorithm when used on a view
public createStandInTable ( string $viewName ) : string
$viewName string Name of view to export
Результат string create statement

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

Table rows extractor, close locks and commits after dump
public endListValues ( string $tableName ) : null
$tableName string Name of table to export
Результат null

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

Build SQL List of all columns on current table
public getColumnStmt ( string $tableName ) : string
$tableName string Name of table to get columns
Результат string SQL sentence with columns

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

Table rows extractor, append information prior to dump
public prepareListValues ( string $tableName ) : null
$tableName string Name of table to export
Результат null

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

Main call
public start ( string $filename = '' ) : null
$filename string Name of file to write sql dump to
Результат null

Описание свойств

$dsn публичное свойство

Connection string for PDO
public string $dsn
Результат string

$fileName публичное свойство

Destination filename, defaults to stdout
public string $fileName
Результат string

$pass публичное свойство

Database password
public string $pass
Результат string

$user публичное свойство

Database username
public string $user
Результат string