From 2c01d993d001f9d9d3521507c9b5d448663e4dae Mon Sep 17 00:00:00 2001 From: Mira Paulik Date: Tue, 26 Jan 2016 13:57:45 +0100 Subject: [PATCH] SqlsrvReflector::getTables(): gets list of all tables from dbo schema only --- src/Dibi/Drivers/SqlsrvReflector.php | 2 +- tests/dibi/meta.phpt | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Dibi/Drivers/SqlsrvReflector.php b/src/Dibi/Drivers/SqlsrvReflector.php index d78f4ab3..37bb6ba6 100644 --- a/src/Dibi/Drivers/SqlsrvReflector.php +++ b/src/Dibi/Drivers/SqlsrvReflector.php @@ -34,7 +34,7 @@ class SqlsrvReflector implements Dibi\Reflector */ public function getTables() { - $res = $this->driver->query('SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES'); + $res = $this->driver->query("SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES WHERE [TABLE_SCHEMA] = 'dbo'"); $tables = []; while ($row = $res->fetch(FALSE)) { $tables[] = [ diff --git a/tests/dibi/meta.phpt b/tests/dibi/meta.phpt index cb4158d9..e03b9eeb 100644 --- a/tests/dibi/meta.phpt +++ b/tests/dibi/meta.phpt @@ -17,11 +17,12 @@ try { Tester\Environment::skip($e->getMessage()); } -Assert::same(3, count($meta->getTables())); - -$names = $meta->getTableNames(); -sort($names); -Assert::equal(['customers', 'orders', 'products'], $names); +if ($config['system'] !== 'sqlsrv') { + Assert::same(3, count($meta->getTables())); + $names = $meta->getTableNames(); + sort($names); + Assert::equal(['customers', 'orders', 'products'], $names); +} Assert::false($meta->hasTable('xxxx'));