method dropDatabase documentation in bbn\Db\Languages\Pgsql

Drops the given database

function(string $database) { if ($this->check()) { if (!Str::checkName($database)) { throw new \Exception(X::_("Wrong database name")." $database"); } if ($database === $this->getCurrent()) { throw new \Exception(X::_('Cannot drop the currently open database!')); } try { $active_connections = $this->rawQuery("SELECT * FROM pg_stat_activity WHERE datname = '$database'"); if ($active_connections->rowCount() > 0) { // Close all active connections $this->rawQuery("SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$database'"); } $this->rawQuery("DROP DATABASE IF EXISTS $database"); } catch (\Exception $e) { return false; } } return $this->check(); }

Drops the given database 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.