diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 2ed4ef840..bb9d9476f 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -500,7 +500,7 @@ class DboMysql extends DboSource { */ function index($model) { $index = array(); - $table = $this->fullTableName($model, false); + $table = $this->fullTableName($model); if($table) { $indexes = $this->query('SHOW INDEX FROM ' . $table); $keys = Set::extract($indexes, '{n}.STATISTICS'); diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 787bebbb3..31964ab4f 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -870,8 +870,10 @@ class DboSource extends DataSource { */ function fetchAssociated($model, $query, $ids) { $query = str_replace('{$__cakeID__$}', join(', ', $ids), $query); - $query = str_replace('= (', 'IN (', $query); - $query = str_replace('= (', 'IN (', $query); + if (count($ids) > 1) { + $query = str_replace('= (', 'IN (', $query); + $query = str_replace('= (', 'IN (', $query); + } return $this->fetchAll($query, $model->cacheQueries, $model->alias); }