mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Optimization on dbo datasource to not repeat ids in find. Fixes #601
Signed-off-by: mark_story <mark@mark-story.com>
This commit is contained in:
parent
7d51952801
commit
2d44929598
1 changed files with 3 additions and 3 deletions
|
@ -924,6 +924,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
|
||||
if (!empty($ins)) {
|
||||
$ins = array_unique($ins);
|
||||
$fetch = $this->fetchAssociated($model, $query, $ins);
|
||||
}
|
||||
|
||||
|
@ -955,10 +956,10 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
if (!empty($ins)) {
|
||||
$ins = array_unique($ins);
|
||||
if (count($ins) > 1) {
|
||||
$query = str_replace('{$__cakeID__$}', '(' .implode(', ', $ins) .')', $query);
|
||||
$query = str_replace('= (', 'IN (', $query);
|
||||
$query = str_replace('= (', 'IN (', $query);
|
||||
} else {
|
||||
$query = str_replace('{$__cakeID__$}',$ins[0], $query);
|
||||
}
|
||||
|
@ -1060,7 +1061,6 @@ class DboSource extends DataSource {
|
|||
$query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query);
|
||||
if (count($ids) > 1) {
|
||||
$query = str_replace('= (', 'IN (', $query);
|
||||
$query = str_replace('= (', 'IN (', $query);
|
||||
}
|
||||
return $this->fetchAll($query, $model->cacheQueries, $model->alias);
|
||||
}
|
||||
|
@ -2179,7 +2179,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
} elseif (is_array($value) && !empty($value) && !$valueInsert) {
|
||||
$keys = array_keys($value);
|
||||
if (array_keys($value) === array_values(array_keys($value))) {
|
||||
if ($keys === array_values($keys)) {
|
||||
$count = count($value);
|
||||
if ($count === 1) {
|
||||
$data = $this->__quoteFields($key) . ' = (';
|
||||
|
|
Loading…
Add table
Reference in a new issue