1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 06:07:39 +02:00

SqlsrvReflector::getTables(): gets list of all tables from dbo schema only

This commit is contained in:
Mira Paulik
2016-01-26 13:57:45 +01:00
committed by David Grudl
parent e415157206
commit 2c01d993d0
2 changed files with 7 additions and 6 deletions

View File

@@ -34,7 +34,7 @@ class SqlsrvReflector implements Dibi\Reflector
*/ */
public function getTables() 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 = []; $tables = [];
while ($row = $res->fetch(FALSE)) { while ($row = $res->fetch(FALSE)) {
$tables[] = [ $tables[] = [

View File

@@ -17,11 +17,12 @@ try {
Tester\Environment::skip($e->getMessage()); Tester\Environment::skip($e->getMessage());
} }
Assert::same(3, count($meta->getTables())); if ($config['system'] !== 'sqlsrv') {
Assert::same(3, count($meta->getTables()));
$names = $meta->getTableNames(); $names = $meta->getTableNames();
sort($names); sort($names);
Assert::equal(['customers', 'orders', 'products'], $names); Assert::equal(['customers', 'orders', 'products'], $names);
}
Assert::false($meta->hasTable('xxxx')); Assert::false($meta->hasTable('xxxx'));