I'm a git noob ;/

This commit is contained in:
k-halaburda 2013-08-13 10:17:14 +02:00
commit 83cca214a1

View file

@ -1,5 +1,4 @@
<?php
/**
* Dbo Source
*
@ -18,6 +17,7 @@
* @since CakePHP(tm) v 0.10.0.1076
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('DataSource', 'Model/Datasource');
App::uses('String', 'Utility');
App::uses('View', 'View');
@ -319,7 +319,8 @@ class DboSource extends DataSource {
public function value($data, $column = null) {
if (is_array($data) && !empty($data)) {
return array_map(
array(&$this, 'value'), $data, array_fill(0, count($data), $column)
array(&$this, 'value'),
$data, array_fill(0, count($data), $column)
);
} elseif (is_object($data) && isset($data->type, $data->value)) {
if ($data->type === 'identifier') {
@ -815,22 +816,26 @@ class DboSource extends DataSource {
return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . $data . $this->endQuote);
}
$items = explode('.', $data);
return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . implode($this->endQuote . '.' . $this->startQuote, $items) . $this->endQuote
return $this->cacheMethod(__FUNCTION__, $cacheKey,
$this->startQuote . implode($this->endQuote . '.' . $this->startQuote, $items) . $this->endQuote
);
}
if (preg_match('/^[\w-]+\.\*$/', $data)) { // string.*
return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . str_replace('.*', $this->endQuote . '.*', $data)
return $this->cacheMethod(__FUNCTION__, $cacheKey,
$this->startQuote . str_replace('.*', $this->endQuote . '.*', $data)
);
}
if (preg_match('/^([\w-]+)\((.*)\)$/', $data, $matches)) { // Functions
return $this->cacheMethod(__FUNCTION__, $cacheKey, $matches[1] . '(' . $this->name($matches[2]) . ')'
return $this->cacheMethod(__FUNCTION__, $cacheKey,
$matches[1] . '(' . $this->name($matches[2]) . ')'
);
}
if (
preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/i', $data, $matches
)) {
return $this->cacheMethod(
__FUNCTION__, $cacheKey, preg_replace(
__FUNCTION__, $cacheKey,
preg_replace(
'/\s{2,}/', ' ', $this->name($matches[1]) . ' ' . $this->alias . ' ' . $this->name($matches[3])
)
);
@ -1508,7 +1513,8 @@ class DboSource extends DataSource {
'conditions' => $queryData['conditions'],
'order' => $queryData['order'],
'group' => $queryData['group']
), $model
),
$model
);
}
if ($external && !empty($assocData['finderQuery'])) {
@ -1529,7 +1535,8 @@ class DboSource extends DataSource {
case 'hasOne':
case 'belongsTo':
$conditions = $this->_mergeConditions(
$assocData['conditions'], $this->getConstraint($type, $model, $linkModel, $association, array_merge($assocData, compact('external', 'self')))
$assocData['conditions'],
$this->getConstraint($type, $model, $linkModel, $association, array_merge($assocData, compact('external', 'self')))
);
if (!$self && $external) {
@ -1977,7 +1984,8 @@ class DboSource extends DataSource {
'alias' => $assoc,
'type' => isset($assocData['type']) ? $assocData['type'] : 'LEFT',
'conditions' => trim($this->conditions(
$this->_mergeConditions($assocData['conditions'], $this->getConstraint($assocData['association'], $model, $model->{$assoc}, $assoc, $assocData)), true, false, $model
$this->_mergeConditions($assocData['conditions'], $this->getConstraint($assocData['association'], $model, $model->{$assoc}, $assoc, $assocData)),
true, false, $model
))
));
}
@ -2633,7 +2641,9 @@ class DboSource extends DataSource {
}
$conditions = str_replace(array($start, $end), '', $conditions);
$conditions = preg_replace_callback(
'/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_][a-z0-9\\-_]*\\.[a-z0-9_][a-z0-9_\\-]*)/i', array(&$this, '_quoteMatchedField'), $conditions
'/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_][a-z0-9\\-_]*\\.[a-z0-9_][a-z0-9_\\-]*)/i',
array(&$this, '_quoteMatchedField'),
$conditions
);
if ($conditions !== null) {
return $conditions;
@ -2934,7 +2944,6 @@ class DboSource extends DataSource {
* @return boolean|void success.
*/
public function resetSequence($table, $column) {
}
/**