Fixing missed cache reads for table schema.

Because cache keys were different, model schema would not be read from
the cache.  Make keys used consistent.

Fixes #2670
This commit is contained in:
mark_story 2012-03-11 10:24:05 -04:00
parent 4b3d8612e9
commit 8c611b236d
4 changed files with 8 additions and 6 deletions

View file

@ -297,7 +297,8 @@ class Mysql extends DboSource {
* @throws CakeException * @throws CakeException
*/ */
public function describe($model) { public function describe($model) {
$cache = parent::describe($model); $key = $this->fullTableName($model, false);
$cache = parent::describe($key);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
} }
@ -331,7 +332,7 @@ class Mysql extends DboSource {
} }
} }
} }
$this->_cacheDescription($this->fullTableName($model, false), $fields); $this->_cacheDescription($key, $fields);
$cols->closeCursor(); $cols->closeCursor();
return $fields; return $fields;
} }

View file

@ -186,8 +186,8 @@ class Postgres extends DboSource {
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
public function describe($model) { public function describe($model) {
$fields = parent::describe($model);
$table = $this->fullTableName($model, false, false); $table = $this->fullTableName($model, false, false);
$fields = parent::describe($table);
$this->_sequenceMap[$table] = array(); $this->_sequenceMap[$table] = array();
$cols = null; $cols = null;

View file

@ -160,11 +160,11 @@ class Sqlite extends DboSource {
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
public function describe($model) { public function describe($model) {
$cache = parent::describe($model); $table = $this->fullTableName($model, false, false);
$cache = parent::describe($table);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
} }
$table = $this->fullTableName($model, false, false);
$fields = array(); $fields = array();
$result = $this->_execute('PRAGMA table_info(' . $table . ')'); $result = $this->_execute('PRAGMA table_info(' . $table . ')');

View file

@ -201,7 +201,8 @@ class Sqlserver extends DboSource {
* @throws CakeException * @throws CakeException
*/ */
public function describe($model) { public function describe($model) {
$cache = parent::describe($model); $table = $this->fullTableName($model, false);
$cache = parent::describe($table);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
} }