Merge pull request #2961 from ovidiupruteanu/patch-3

Sqlserver->describe failing for models with a schemaName
This commit is contained in:
Mark Story 2014-03-11 21:03:54 -04:00
commit fda242f000

View file

@ -201,7 +201,8 @@ class Sqlserver extends DboSource {
return $cache;
}
$fields = array();
$table = $this->fullTableName($model, false);
$table = $this->fullTableName($model, false, false);
$schema = $model->schemaName;
$cols = $this->_execute(
"SELECT
COLUMN_NAME as Field,
@ -212,7 +213,7 @@ class Sqlserver extends DboSource {
COLUMNPROPERTY(OBJECT_ID('" . $table . "'), COLUMN_NAME, 'IsIdentity') as [Key],
NUMERIC_SCALE as Size
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '" . $table . "'"
WHERE TABLE_NAME = '" . $table . "'" . ($schema ? " AND TABLE_SCHEMA = '" . $schema . "'" : '')
);
if (!$cols) {
throw new CakeException(__d('cake_dev', 'Could not describe table for %s', $table));