mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 15:05:45 +00:00
API CHANGE: Added getParameters() to PostgreSQLDatabase
API CHANGE: Added 'port' parameter to PostgreSQLDatabase
This commit is contained in:
parent
b59ce20a97
commit
9e8cc03243
@ -87,13 +87,15 @@ class PostgreSQLDatabase extends SS_Database {
|
||||
$dbName=$parameters['database'];
|
||||
else $dbName=$this->database;
|
||||
|
||||
$port = empty($parameters['port']) ? 5432 : $parameters['port'];
|
||||
|
||||
//First, we need to check that this database exists. To do this, we will connect to the 'postgres' database first
|
||||
$this->dbConn = pg_connect('host=' . $parameters['server'] . ' port=5432 dbname=postgres' . $username . $password);
|
||||
$this->dbConn = pg_connect('host=' . $parameters['server'] . ' port=' . $port . ' dbname=postgres' . $username . $password);
|
||||
if(!$this->databaseExists($dbName))
|
||||
$this->createDatabase($dbName);
|
||||
|
||||
//Now we can be sure that this database exists, so we can connect to it
|
||||
$this->dbConn = pg_connect('host=' . $parameters['server'] . ' port=5432 dbname=' . $dbName . $username . $password);
|
||||
$this->dbConn = pg_connect('host=' . $parameters['server'] . ' port=' . $port . ' dbname=' . $dbName . $username . $password);
|
||||
|
||||
//By virtue of getting here, the connection is active:
|
||||
$this->active=true;
|
||||
@ -113,6 +115,13 @@ class PostgreSQLDatabase extends SS_Database {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the parameters used to construct this database connection
|
||||
*/
|
||||
public function getParameters() {
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this database supports collations
|
||||
* TODO: get rid of this?
|
||||
|
Loading…
x
Reference in New Issue
Block a user