PHP Class Ifsnop\Mysqldump\Mysqldump

Author: Michael J. Calkins ([email protected])
Author: Diego Torres ([email protected])
Afficher le fichier Open project: clouddueling/mysqldump-php Class Usage Examples

Méthodes publiques

Свойство Type Description
$dsn string Connection string for PDO
$fileName string Destination filename, defaults to stdout
$pass string Database password
$user string Database username

Méthodes publiques

Méthode Description
__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

Private Methods

Méthode Description
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

Method Details

__construct() public méthode

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() public méthode

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

array_replace_recursive() public static méthode

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
Résultat array Returns an array, or NULL if an error occurs.

createStandInTable() public méthode

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
Résultat string create statement

endListValues() public méthode

Table rows extractor, close locks and commits after dump
public endListValues ( string $tableName ) : null
$tableName string Name of table to export
Résultat null

getColumnStmt() public méthode

Build SQL List of all columns on current table
public getColumnStmt ( string $tableName ) : string
$tableName string Name of table to get columns
Résultat string SQL sentence with columns

prepareListValues() public méthode

Table rows extractor, append information prior to dump
public prepareListValues ( string $tableName ) : null
$tableName string Name of table to export
Résultat null

start() public méthode

Main call
public start ( string $filename = '' ) : null
$filename string Name of file to write sql dump to
Résultat null

Property Details

$dsn public_oe property

Connection string for PDO
public string $dsn
Résultat string

$fileName public_oe property

Destination filename, defaults to stdout
public string $fileName
Résultat string

$pass public_oe property

Database password
public string $pass
Résultat string

$user public_oe property

Database username
public string $user
Résultat string