Removing some duplicate code

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4825 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-04-09 04:05:22 +00:00
parent 95e2782d72
commit cff6ea0ee8

View file

@ -1084,9 +1084,6 @@ class DboSource extends DataSource {
}
function buildStatement($query, $model) {
if(isset($query['in'])) {
return $this->renderInStatement($query, $model);
}
$query = am(array('offset' => null, 'joins' => array()), $query);
if (!empty($query['joins'])) {
for ($i = 0; $i < count($query['joins']); $i++) {
@ -1095,6 +1092,12 @@ class DboSource extends DataSource {
}
}
}
if(isset($query['in'])) {
$query['conditions'] = $query['in'];
return $this->renderInStatement($query, $model);
}
return $this->renderStatement(array(
'conditions' => $this->conditions($query['conditions']),
'fields' => join(', ', $query['fields']),
@ -1107,17 +1110,6 @@ class DboSource extends DataSource {
}
function renderInStatement($query, $model) {
if(isset($query['in'])) {
$query['conditions'] = $query['in'];
}
$query = am(array('offset' => null, 'joins' => array()), $query);
if (!empty($query['joins'])) {
for ($i = 0; $i < count($query['joins']); $i++) {
if (is_array($query['joins'][$i])) {
$query['joins'][$i] = $this->buildJoinStatement($query['joins'][$i]);
}
}
}
$replace[] = '{$__cakeID__$}';
$replace[] = $this->renderStatement(array(
'conditions' => $this->conditions($query['conditions']),