PMCORE-3844

This commit is contained in:
Julio Cesar Laura Avendaño
2022-05-26 14:56:23 +00:00
committed by Mauricio Veliz
parent 7bb67a97bd
commit 9f1b738093
82 changed files with 300 additions and 552 deletions

View File

@@ -53,9 +53,7 @@ class PgSQLConnection extends ConnectionCommon implements Connection {
* @return void
*/
function connect($dsninfo, $flags = 0)
{
global $php_errormsg;
{
if (!extension_loaded('pgsql')) {
throw new SQLException('pgsql extension not loaded');
}
@@ -100,9 +98,13 @@ class PgSQLConnection extends ConnectionCommon implements Connection {
}
if (!$conn) {
// Set message error
$lastError = error_get_last();
$errorMessage = $lastError['message'] ?? 'Connection error.';
// hide the password from connstr
$cleanconnstr = preg_replace('/password=\'.*?\'($|\s)/', 'password=\'*********\'', $connstr);
throw new SQLException('Could not connect', $php_errormsg, $cleanconnstr);
throw new SQLException('Could not connect', $errorMessage, $cleanconnstr);
}
$this->dblink = $conn;