Permalink
Browse files

Update the listSources.

  • Loading branch information...
1 parent 244bc13 commit 3f984b68facd9ba3c1eaa49d87d2bd115a87ce61 @jrbasso jrbasso committed Apr 28, 2011
Showing with 13 additions and 13 deletions.
  1. +13 −13 lib/Cake/Model/Datasource/Database/Mssql.php
@@ -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;
}
/**

0 comments on commit 3f984b6

Please sign in to comment.