PHP Class DbPatch_Core_Db

Author: Sandy Pleyte
Author: Martijn De Letter
Show file Open project: dbpatch/dbpatch Class Usage Examples

Protected Properties

Property Type Description
$adapter null | Zend_Db_Adapter_Abstract
$config Zend_Config

Public Methods

Method Description
__construct ( Zend_Config | Zend_Config_Ini | Zend_Config_Xml $config ) : void
dump ( string $filename ) : boolean Dump database to file
getAdapter ( ) : null | Zend_Db_Adapter_Abstract
getConfig ( ) : Zend_Config
import ( string $filename ) : boolean Import a SQL file
reconnect ( ) : DbPatch_Core_Db Reconnect to the database, this will create a new adapter instance.

Protected Methods

Method Description
enableOldConfigCompatibility ( ) : DbPatch_Core_Db This method provides backward compatibility for the 'bin_dir' configuration option. it could be removed in future versions. using bin_dir only is not sufficient because it limits the user to mysql/mysqldump. it's also not possible to use bin_dir and pass a Zend_Db_Adapter instance as configuration value.
getCliCommand ( string $command, string $filename ) : string

Method Details

__construct() public method

public __construct ( Zend_Config | Zend_Config_Ini | Zend_Config_Xml $config ) : void
$config Zend_Config | Zend_Config_Ini | Zend_Config_Xml
return void

dump() public method

Dump database to file
public dump ( string $filename ) : boolean
$filename string
return boolean

enableOldConfigCompatibility() protected method

This method provides backward compatibility for the 'bin_dir' configuration option. it could be removed in future versions. using bin_dir only is not sufficient because it limits the user to mysql/mysqldump. it's also not possible to use bin_dir and pass a Zend_Db_Adapter instance as configuration value.
protected enableOldConfigCompatibility ( ) : DbPatch_Core_Db
return DbPatch_Core_Db

getAdapter() public method

public getAdapter ( ) : null | Zend_Db_Adapter_Abstract
return null | Zend_Db_Adapter_Abstract

getCliCommand() protected method

protected getCliCommand ( string $command, string $filename ) : string
$command string Shell command template to execute, takes :configkey notation
$filename string Filename of patch or dump file
return string Command to execute

getConfig() public method

public getConfig ( ) : Zend_Config
return Zend_Config

import() public method

Import a SQL file
public import ( string $filename ) : boolean
$filename string
return boolean

reconnect() public method

Reconnect to the database, this will create a new adapter instance.
public reconnect ( ) : DbPatch_Core_Db
return DbPatch_Core_Db

Property Details

$adapter protected property

protected null|Zend_Db_Adapter_Abstract $adapter
return null | Zend_Db_Adapter_Abstract

$config protected property

protected Zend_Config $config
return Zend_Config