1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 14:16: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()
{
$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[] = [

View File

@@ -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'));