PHP Class Habari\PGSQLConnection

Inheritance: extends DatabaseConnection
Datei anzeigen Open project: habari/system

Public Methods

Method Description
connect ( string $connect_string, string $db_user, string $db_pass ) : boolean Extends default connection method. It will be useful in order to allow accents and other DB-centric global commands.
dbdelta ( $queries, $execute = true, $silent = true, boolean $doinserts = false ) : array automatic diffing function - used for determining required database upgrades based on Owen Winkler's microwiki upgrade function
replace_concat ( array $matches ) : string Replaces the MySQL CONCAT function with PostgreSQL-compatible statements
sql_t ( string $sql, array &$args ) : string Database specific SQL translation function, loosely modelled on the internationalization _t() function.
upgrade_post ( integer $old_version, $upgrade_path = '' ) : boolean Run all of the upgrades slated for post-dbdelta since the last database revision.
upgrade_pre ( integer $old_version, $upgrade_path = '' ) : boolean Run all of the upgrades slated for pre-dbdelta since the last database revision.

Method Details

connect() public method

Extends default connection method. It will be useful in order to allow accents and other DB-centric global commands.
public connect ( string $connect_string, string $db_user, string $db_pass ) : boolean
$connect_string string a PDO connection string
$db_user string the database user name
$db_pass string the database user password
return boolean true on success, false on error

dbdelta() public method

automatic diffing function - used for determining required database upgrades based on Owen Winkler's microwiki upgrade function
public dbdelta ( $queries, $execute = true, $silent = true, boolean $doinserts = false ) : array
$doinserts boolean (optional) Execute all insert queries found, default=false
return array list of updates made

replace_concat() public method

Replaces the MySQL CONCAT function with PostgreSQL-compatible statements
See also: PGSQLConnection::sql_t()
public replace_concat ( array $matches ) : string
$matches array Matches from the regex in sql_t()
return string The replacement for the MySQL SQL

sql_t() public method

Call with a database independent SQL string and it will be translated to a PostgreSQL specific SQL string.
public sql_t ( string $sql, array &$args ) : string
$sql string database independent SQL
$args array An array of SQL arguments
return string translated SQL string

upgrade_post() public method

Run all of the upgrades slated for post-dbdelta since the last database revision.
public upgrade_post ( integer $old_version, $upgrade_path = '' ) : boolean
$old_version integer The current version of the database that is being upgraded
return boolean True on success

upgrade_pre() public method

Run all of the upgrades slated for pre-dbdelta since the last database revision.
public upgrade_pre ( integer $old_version, $upgrade_path = '' ) : boolean
$old_version integer The current version of the database that is being upgraded
return boolean True on success