method getConnection documentation in bbn\Db\Languages\Pgsql

function(array $cfg = []) { if (!X::hasProps($cfg, ['host', 'user'])) { if (!defined('BBN_DB_HOST')) { throw new \Exception(X::_("No DB host defined")); } $cfg = [ 'host' => BBN_DB_HOST, 'user' => defined('BBN_DB_USER') ? BBN_DB_USER : '', 'pass' => defined('BBN_DB_PASS') ? BBN_DB_PASS : '', 'db' => defined('BBN_DATABASE') ? BBN_DATABASE : '', ]; } $cfg['engine'] = 'pgsql'; if (empty($cfg['host'])) { $cfg['host'] = '127.0.0.1'; } if (empty($cfg['user'])) { $cfg['user'] = 'root'; } if (!isset($cfg['pass'])) { $cfg['pass'] = ''; } if (empty($cfg['port']) || !is_int($cfg['port'])) { $cfg['port'] = 5432; } $cfg['code_db'] = $cfg['db'] ?? ''; $cfg['code_host'] = $cfg['user'].'@'.$cfg['host']; $cfg['args'] = ['pgsql:host=' .(in_array($cfg['host'], ['localhost', '127.0.0.1']) && empty($cfg['force_host']) ? gethostname() : $cfg['host']) .';port='.$cfg['port'] .(empty($cfg['db']) ? '' : ';dbname=' . $cfg['db']), $cfg['user'], $cfg['pass'], [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'], ]; return $cfg; }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.