method change documentation in bbn\Db\Languages\Pgsql
Changes the current database to the given one.
function(string $db)
{
if (($this->getCurrent() !== $db) && Str::checkName($db)) {
$old_db = $this->getCurrent();
// Close the current connection
$this->pdo = null;
// Invoke the constructor method after changing the db name.
// pgsql does not support changing database, only by creating new connection.
$this->cfg['db'] = $db;
try {
$this->__construct($this->cfg);
} catch (\Exception $e) {
$this->cfg['db'] = $old_db;
$this->__construct($this->cfg);
throw new \Exception($e->getMessage());
}
return true;
}
return false;
}
Changes the current database to the given one. 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.
© 2011-2024
BBN Solutions