Skip to content

Commit

Permalink
Removed schema check. The old lib dont have it too
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Jan 14, 2014
1 parent 1769c5c commit 7f79471
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions Cake/Database/Schema/SqlserverSchema.php
Expand Up @@ -29,8 +29,7 @@ class SqlserverSchema extends BaseSchema {
*
*/
public function listTablesSql($config) {
$schema = empty($config['schema']) ? 'dbo' : $config['schema'];
return ['SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? ORDER BY TABLE_NAME', [$schema]];
return ['SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME', []];
}

/**
Expand All @@ -44,11 +43,10 @@ public function describeTableSql($name, $config) {
CHARACTER_MAXIMUM_LENGTH AS [char_length],
'' AS [comment], ORDINAL_POSITION AS [ordinal_position]
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = ? AND TABLE_SCHEMA = ?
WHERE TABLE_NAME = ?
ORDER BY ordinal_position";

$schema = empty($config['schema']) ? 'dbo' : $config['schema'];
return [$sql, [$name, $schema]];
return [$sql, [$name]];
}

/**
Expand Down Expand Up @@ -167,12 +165,11 @@ public function describeIndexSql($table, $config) {
INNER JOIN sys.[indexes] I ON T.[object_id] = I.[object_id]
INNER JOIN sys.[index_columns] IC ON I.[object_id] = IC.[object_id] AND I.[index_id] = IC.[index_id]
INNER JOIN sys.[all_columns] AC ON T.[object_id] = AC.[object_id] AND IC.[column_id] = AC.[column_id]
WHERE T.[is_ms_shipped] = 0 AND I.[type_desc] <> 'HEAP' AND T.[name] = ? AND OBJECT_SCHEMA_NAME(T.[object_id],DB_ID()) = ?
WHERE T.[is_ms_shipped] = 0 AND I.[type_desc] <> 'HEAP' AND T.[name] = ?
ORDER BY I.[index_id], IC.[index_column_id]
";

$schema = empty($config['schema']) ? 'dbo' : $config['schema'];
return [$sql, [$table, $schema]];
return [$sql, [$table]];
}

/**
Expand Down Expand Up @@ -228,11 +225,10 @@ public function describeForeignKeySql($table, $config) {
INNER JOIN sys.tables RT ON RT.object_id = FKC.referenced_object_id
INNER JOIN sys.columns C ON C.column_id = FKC.parent_column_id AND C.object_id = FKC.parent_object_id
INNER JOIN sys.columns RC ON RC.column_id = FKC.referenced_column_id AND RC.object_id = FKC.referenced_object_id
WHERE FK.is_ms_shipped = 0 AND T.name = ? AND OBJECT_SCHEMA_NAME(T.[object_id],DB_ID()) = ?
WHERE FK.is_ms_shipped = 0 AND T.name = ?
";

$schema = empty($config['schema']) ? 'dbo' : $config['schema'];
return [$sql, [$table, $schema]];
return [$sql, [$table]];
}

/**
Expand Down

0 comments on commit 7f79471

Please sign in to comment.