Methods |
public __construct(string $dsn = '', ?string $user = NULL, ?string $pass = NULL, array $settings = [], array $pdoOptions = []) Constructor of Mysqldump.
|
public addTypeAdapter(string $adapterClassName) Add TypeAdapter
|
public getAdapter() : Druidfi |
public getTableLimit(string $tableName) Returns the LIMIT for the table. Must be numeric to be returned. |
public getTableWhere(string $tableName) |
public setInfoHook(callable $callable) Set a callable that will be used to report dump information. |
public setTableLimits(array $tableLimits) Keyed by table name, with the value as the numeric limit: e.g. 'users' => 3000 |
public setTableWheres(array $tableWheres) Keyed by table name, with the value as the conditions: e.g. 'users' => 'date_registered > NOW() - INTERVAL 6 MONTH AND deleted=0' |
public setTransformTableRowHook(callable $callable) Set a callable that will be used to transform table rows. |
public start(?string $filename = '') Primary function, triggers dumping.
|
Methods |
protected getColumnStmt(string $tableName) : array Build SQL List of all columns on current table which will be used for selecting.
|
protected tableColumnTypes() : array Get table column types. |
Properties |
private static string $adapterClass = 'Druidfi\Mysqldump\TypeAdapter\TypeAdapterMysql' |
private PDO $conn |
private Druidfi |
private string $dbName |
private string $dsn |
private array $events = [] |
private array $functions = [] |
private string $host |
private $infoCallable = NULL |
private Druidfi |
private ?string $pass |
private array $pdoOptions |
private array $procedures = [] |
private Druidfi |
private array $tableColumnTypes = [] |
private array $tableLimits = [] |
private array $tables = [] |
private array $tableWheres = [] Keyed on table name, with the value as the conditions. e.g. - 'users' => 'date_registered > NOW() - INTERVAL 6 MONTH' |
private $transformColumnValueCallable = NULL |
private $transformTableRowCallable = NULL |
private array $triggers = [] |
private ?string $user |
private array $views = [] |
Methods |
private connect() Connect with PDO.
|
private 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.
|
private endListValues(string $tableName, int $count = 0) Table rows extractor, close locks and commits after dump.
|
private exportEvents() Exports all the events found in database.
|
private exportFunctions() Exports all the functions found in database. |
private exportProcedures() Exports all the procedures found in database. |
private exportTables() Exports all the tables selected from database |
private exportTriggers() Exports all the triggers found in database. |
private exportViews() Exports all the views found in database. |
private getColumnNames(string $tableName) : array Build SQL List of all columns on current table which will be used for inserting.
|
private getDatabaseStructureEvents() Reads event names from database. Fills $this->tables array so they will be dumped later. |
private getDatabaseStructureFunctions() Reads functions names from database. Fills $this->tables array so they will be dumped later. |
private getDatabaseStructureProcedures() Reads procedure names from database. Fills $this->tables array so they will be dumped later. |
private getDatabaseStructureTables() Reads table names from database. Fills $this->tables array so they will be dumped later. |
private getDatabaseStructureTriggers() Reads trigger names from database. Fills $this->tables array so they will be dumped later. |
private getDatabaseStructureViews() Reads view names from database. Fills $this->tables array so they will be dumped later. |
private getDumpFileFooter() : string Returns footer for dump file. |
private getDumpFileHeader() : string Returns header for dump file. |
private getEventStructure(string $eventName) Event structure extractor.
|
private getFunctionStructure(string $functionName) Function structure extractor.
|
private getProcedureStructure(string $procedureName) Procedure structure extractor.
|
private getTableColumnTypes(string $tableName) : array Store column types to create data dumps and for Stand-In tables.
|
private getTableStructure(string $tableName) Table structure extractor.
|
private getTriggerStructure(string $triggerName) Trigger structure extractor.
|
private getViewStructureTable(string $viewName) View structure extractor, create table (avoids cyclic references).
|
private getViewStructureView(string $viewName) View structure extractor, create view. |
private listValues(string $tableName) Table rows extractor.
|
private matches(string $table, array $arr) : bool Compare if $table name matches with a definition inside $arr. |
private parseDsn(string $dsn) : string 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
|
private prepareColumnValues(string $tableName, array $row) : array Prepare values for output.
|
private prepareListValues(string $tableName) Table rows extractor, append information prior to dump.
|
private write(string $data) : int |
Properties |
private static string $adapterClass = 'Druidfi\Mysqldump\TypeAdapter\TypeAdapterMysql' |