mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-06-13 02:03:36 +00:00
Update the listSources.
This commit is contained in:
parent
244bc1369a
commit
3f984b68fa
1 changed files with 14 additions and 14 deletions
|
@ -151,26 +151,26 @@ class Mssql extends DboSource {
|
||||||
*
|
*
|
||||||
* @return array Array of tablenames in the database
|
* @return array Array of tablenames in the database
|
||||||
*/
|
*/
|
||||||
function listSources() {
|
public function listSources() {
|
||||||
$cache = parent::listSources();
|
$cache = parent::listSources();
|
||||||
|
if ($cache !== null) {
|
||||||
if ($cache != null) {
|
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
$result = $this->fetchAll('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES', false);
|
$result = $this->_execute("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'"));
|
||||||
|
|
||||||
if (!$result || empty($result)) {
|
if (!$result) {
|
||||||
|
$result->closeCursor();
|
||||||
return array();
|
return array();
|
||||||
} else {
|
|
||||||
$tables = array();
|
|
||||||
|
|
||||||
foreach ($result as $table) {
|
|
||||||
$tables[] = $table[0]['TABLE_NAME'];
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::listSources($tables);
|
|
||||||
return $tables;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tables = array();
|
||||||
|
while ($line = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$tables[] = $line['TABLE_NAME'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->closeCursor();
|
||||||
|
parent::listSources($tables);
|
||||||
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue