mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Sqlserver->describe failing for models with a schemaName
When models have a schemaName set it was searching for TABLE_NAME = 'schema_name.table_name'. Instead it should search for TABLE_NAME = 'table_name' AND TABLE_SCHEMA = 'schema_name'
This commit is contained in:
parent
8b1e5e31c7
commit
56a3f093a1
1 changed files with 3 additions and 2 deletions
|
@ -201,7 +201,8 @@ class Sqlserver extends DboSource {
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
$fields = array();
|
$fields = array();
|
||||||
$table = $this->fullTableName($model, false);
|
$table = $this->fullTableName($model, false, false);
|
||||||
|
$schema = $model->schemaName;
|
||||||
$cols = $this->_execute(
|
$cols = $this->_execute(
|
||||||
"SELECT
|
"SELECT
|
||||||
COLUMN_NAME as Field,
|
COLUMN_NAME as Field,
|
||||||
|
@ -212,7 +213,7 @@ class Sqlserver extends DboSource {
|
||||||
COLUMNPROPERTY(OBJECT_ID('" . $table . "'), COLUMN_NAME, 'IsIdentity') as [Key],
|
COLUMNPROPERTY(OBJECT_ID('" . $table . "'), COLUMN_NAME, 'IsIdentity') as [Key],
|
||||||
NUMERIC_SCALE as Size
|
NUMERIC_SCALE as Size
|
||||||
FROM INFORMATION_SCHEMA.COLUMNS
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
WHERE TABLE_NAME = '" . $table . "'"
|
WHERE TABLE_NAME = '" . $table . "'".($schema?" AND TABLE_SCHEMA = '" . $schema . "'":'')
|
||||||
);
|
);
|
||||||
if (!$cols) {
|
if (!$cols) {
|
||||||
throw new CakeException(__d('cake_dev', 'Could not describe table for %s', $table));
|
throw new CakeException(__d('cake_dev', 'Could not describe table for %s', $table));
|
||||||
|
|
Loading…
Add table
Reference in a new issue