Reverting changes made by gwoo

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3284 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-07-22 16:45:18 +00:00
parent ceb72b3415
commit 4347f25025
3 changed files with 79 additions and 92 deletions

View file

@ -414,7 +414,7 @@ class DboMysqli extends DboSource {
$resultRow = array(); $resultRow = array();
$i = 0; $i = 0;
foreach ($row as $index => $field) { foreach ($row as $index => $field) {
list($table, $column) = $this->map[$index]; @list($table, $column) = $this->map[$index];
$resultRow[$table][$column] = $row[$index]; $resultRow[$table][$column] = $row[$index];
$i++; $i++;
} }

View file

@ -829,22 +829,6 @@ class DboSource extends DataSource {
} }
} }
return $sql; return $sql;
} else {
if (isset($linkModel->assoc['conditions']) && !empty($linkModel->assoc['conditions'])) {
$assocData['conditions'] = $linkModel->assoc['conditions'];
}
if (isset($linkModel->assoc['fields']) && !empty($linkModel->assoc['fields'])) {
$assocData['fields'] = $linkModel->assoc['fields'];
}
if (isset($linkModel->assoc['order']) && !empty($linkModel->assoc['order'])) {
$assocData['order'] = $linkModel->assocData['order'];
}
if (isset($linkModel->assoc['limit']) && !empty($linkModel->assoc['limit'])) {
$assocData['limit'] = $linkModel->assocData['limit'];
}
if (isset($linkModel->assoc['offset']) && !empty($linkModel->assoc['offset'])) {
$assocData['offset'] = $linkModel->assocData['offset'];
}
} }
$alias = $association; $alias = $association;
@ -855,18 +839,19 @@ class DboSource extends DataSource {
switch($type) { switch($type) {
case 'hasOne': case 'hasOne':
if ($external || isset($assocData['external'])) { if ($external || isset($assocData['external'])) {
if (isset($assocData['finderQuery'])) { if (isset($assocData['finderQuery'])) {
return $assocData['finderQuery']; return $assocData['finderQuery'];
} }
if (!isset($assocData['limit'])) { if (!isset($assocData['fields'])) {
$assocData['limit'] = $queryData['limit']; $assocData['fields'] = '';
} }
if (!isset($assocData['offset'])) {
$assocData['offset'] = $queryData['offset']; $limit = '';
if (isset($queryData['limit']) && !empty($queryData['limit'])) {
$limit = $this->limit($queryData['limit'], $queryData['offset']);
} }
$limit = $this->limit($assocData['limit'], $assocData['offset']);
$sql = 'SELECT '; $sql = 'SELECT ';
if ($this->goofyLimit) { if ($this->goofyLimit) {
@ -900,6 +885,9 @@ class DboSource extends DataSource {
return $sql; return $sql;
} else { } else {
if (!isset($assocData['fields'])) {
$assocData['fields'] = '';
}
if ($this->__bypass === false) { if ($this->__bypass === false) {
$fields = join(', ', $this->fields($linkModel, $alias, $assocData['fields'])); $fields = join(', ', $this->fields($linkModel, $alias, $assocData['fields']));
@ -932,14 +920,14 @@ class DboSource extends DataSource {
break; break;
case 'belongsTo': case 'belongsTo':
if ($external || isset($assocData['external'])) { if ($external || isset($assocData['external'])) {
$limit = '';
if (isset($assocData['limit'])) {
$limit = $this->limit($assocData['limit'], $queryData['offset']);
}
if (!isset($assocData['limit'])) { if (!isset($assocData['fields'])) {
$assocData['limit'] = $queryData['limit']; $assocData['fields'] = '';
} }
if (!isset($assocData['offset'])) {
$assocData['offset'] = $queryData['offset'];
}
$limit = $this->limit($assocData['limit'], $assocData['offset']);
$sql = 'SELECT '; $sql = 'SELECT ';
if ($this->goofyLimit) { if ($this->goofyLimit) {
@ -970,6 +958,9 @@ class DboSource extends DataSource {
return $sql; return $sql;
} else { } else {
if (!isset($assocData['fields'])) {
$assocData['fields'] = '';
}
if ($this->__bypass === false) { if ($this->__bypass === false) {
$fields = join(', ', $this->fields($linkModel, $alias, $assocData['fields'])); $fields = join(', ', $this->fields($linkModel, $alias, $assocData['fields']));
@ -1012,10 +1003,12 @@ class DboSource extends DataSource {
$sql = $assocData['finderQuery']; $sql = $assocData['finderQuery'];
} else { } else {
$limit = $this->limit($assocData['limit'], $assocData['offset']); $limit = '';
if (isset($assocData['limit'])) {
$limit = $this->limit($assocData['limit'], $queryData['offset']);
}
$conditions = $assocData['conditions']; $conditions = $assocData['conditions'];
$sql = 'SELECT '; $sql = 'SELECT ';
if ($this->goofyLimit) { if ($this->goofyLimit) {
@ -1037,7 +1030,6 @@ class DboSource extends DataSource {
} }
$sql .= $this->conditions($conditions); $sql .= $this->conditions($conditions);
$sql .= $this->order($assocData['order']); $sql .= $this->order($assocData['order']);
if (!$this->goofyLimit) { if (!$this->goofyLimit) {
@ -1052,7 +1044,10 @@ class DboSource extends DataSource {
} else { } else {
$joinTbl = $this->fullTableName($assocData['joinTable']); $joinTbl = $this->fullTableName($assocData['joinTable']);
$limit = $this->limit($assocData['limit'], $assocData['offset']); $limit = '';
if (isset($assocData['limit'])) {
$limit = $this->limit($assocData['limit'], $queryData['offset']);
}
$sql = 'SELECT '; $sql = 'SELECT ';
@ -1088,7 +1083,6 @@ class DboSource extends DataSource {
$sql .= ' = ' . $this->name($alias) . '.' . $this->name($linkModel->primaryKey); $sql .= ' = ' . $this->name($alias) . '.' . $this->name($linkModel->primaryKey);
$sql .= $this->conditions($assocData['conditions']); $sql .= $this->conditions($assocData['conditions']);
$sql .= $this->order($assocData['order']); $sql .= $this->order($assocData['order']);
if (!$this->goofyLimit) { if (!$this->goofyLimit) {

View file

@ -293,16 +293,9 @@ class Model extends Object {
var $__associationKeys = array( var $__associationKeys = array(
'belongsTo' => array('className', 'conditions', 'order', 'foreignKey', 'counterCache'), 'belongsTo' => array('className', 'conditions', 'order', 'foreignKey', 'counterCache'),
'hasOne' => array('className', 'conditions', 'order', 'foreignKey', 'dependent'), 'hasOne' => array('className', 'conditions', 'order', 'foreignKey', 'dependent'),
'hasMany' => array('className', 'conditions', 'order','limit','offset', 'foreignKey', 'fields', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'), 'hasMany' => array('className', 'conditions', 'order', 'foreignKey', 'fields', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
'hasAndBelongsToMany' => array('className', 'joinTable', 'fields', 'foreignKey', 'associationForeignKey', 'conditions', 'order','limit','offset', 'uniq', 'finderQuery', 'deleteQuery', 'insertQuery', 'with') 'hasAndBelongsToMany' => array('className', 'joinTable', 'fields', 'foreignKey', 'associationForeignKey', 'conditions', 'order', 'uniq', 'finderQuery', 'deleteQuery', 'insertQuery', 'with')
); );
/**
* Access to the association property keys
*
* @var array
* @access public
*/
var $assoc = array('conditions', 'fields', 'order', 'limit','offset');
/** /**
* Holds provided/generated association key names and other data for all associations * Holds provided/generated association key names and other data for all associations