From 0fc7355e6bceacd156f695e394fb72ccc6b7b849 Mon Sep 17 00:00:00 2001 From: gwoo Date: Fri, 27 Jun 2008 05:34:37 +0000 Subject: [PATCH] another small optimization from last fix git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7281 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/model/datasources/dbo/dbo_mysql.php | 2 +- cake/libs/model/datasources/dbo_source.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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); }