Skip to content

Commit

Permalink
Update the listSources.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed May 6, 2011
1 parent 244bc13 commit 3f984b6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/Cake/Model/Datasource/Database/Mssql.php
Expand Up @@ -151,26 +151,26 @@ public function enabled() {
*
* @return array Array of tablenames in the database
*/
function listSources() {
public function listSources() {
$cache = parent::listSources();

if ($cache != null) {
if ($cache !== null) {
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();
} 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;
}

/**
Expand Down

0 comments on commit 3f984b6

Please sign in to comment.