method getTables documentation in bbn\Db\Languages\Pgsql
Return tables' names of a database as an array.
Example
X::dump($db->getTables('db_example'));
/*
(array) [
"clients",
"columns",
"cron",
"journal",
"dbs",
"examples",
"history",
"hosts",
"keys",
"mails",
"medias",
"notes",
"medias",
"versions"
]
function(string $database = '')
{
if (!$this->check()) {
return null;
}
if (empty($database) || !bbn\Str::checkName($database)) {
$database = $this->getCurrent();
}
if ($database !== $this->getCurrent()) {
return (new self (
array_merge($this->cfg, ['db' => $database])
))
->getTables();
}
$t2 = [];
$query = "SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE'";
if (($r = $this->rawQuery($query))
&& ($t1 = $this->fetchAllResults($r, \PDO::FETCH_NUM))
) {
foreach ($t1 as $t) {
$t2[] = $t[0];
}
}
return $t2;
}
Return tables' names of a database as an array. 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-2023
BBN Solutions