mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-10 05:22:41 +00:00
Merge remote branch 'origin/1.2' into 1.2-merger
Conflicts: cake/VERSION.txt cake/config/config.php cake/console/libs/tasks/model.php cake/dispatcher.php cake/libs/l10n.php cake/libs/model/datasources/dbo_source.php cake/libs/view/pages/home.ctp cake/tests/cases/console/libs/tasks/model.test.php cake/tests/cases/libs/view/helpers/ajax.test.php cake/tests/cases/libs/view/helpers/text.test.php
This commit is contained in:
commit
6a3347ef7c
15 changed files with 128 additions and 43 deletions
|
@ -166,10 +166,15 @@ class TreeBehavior extends ModelBehavior {
|
|||
$Model->data[$Model->alias][$parent] = null;
|
||||
$this->_addToWhitelist($Model, $parent);
|
||||
} else {
|
||||
list($node) = array_values($Model->find('first', array(
|
||||
$values = $Model->find('first', array(
|
||||
'conditions' => array($scope,$Model->escapeField() => $Model->id),
|
||||
'fields' => array($Model->primaryKey, $parent, $left, $right ), 'recursive' => $recursive)
|
||||
));
|
||||
);
|
||||
|
||||
if ($values === false) {
|
||||
return false;
|
||||
}
|
||||
list($node) = array_values($values);
|
||||
|
||||
$parentNode = $Model->find('first', array(
|
||||
'conditions' => array($scope, $Model->escapeField() => $Model->data[$Model->alias][$parent]),
|
||||
|
@ -822,11 +827,16 @@ class TreeBehavior extends ModelBehavior {
|
|||
$this->__sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
|
||||
$this->__sync($Model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created);
|
||||
} else {
|
||||
$parentNode = array_values($Model->find('first', array(
|
||||
$values = $Model->find('first', array(
|
||||
'conditions' => array($scope, $Model->escapeField() => $parentId),
|
||||
'fields' => array($Model->primaryKey, $left, $right),
|
||||
'recursive' => $recursive
|
||||
)));
|
||||
));
|
||||
|
||||
if ($values === false) {
|
||||
return false;
|
||||
}
|
||||
$parentNode = array_values($values);
|
||||
|
||||
if (empty($parentNode) || empty($parentNode[0])) {
|
||||
return false;
|
||||
|
|
|
@ -102,6 +102,13 @@ class DboMssql extends DboSource {
|
|||
'rollback' => 'ROLLBACK'
|
||||
);
|
||||
|
||||
/**
|
||||
* Define if the last query had error
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $__lastQueryHadError = false;
|
||||
/**
|
||||
* MS SQL DBO driver constructor; sets SQL Server error reporting defaults
|
||||
*
|
||||
|
@ -183,7 +190,9 @@ class DboMssql extends DboSource {
|
|||
* @access protected
|
||||
*/
|
||||
function _execute($sql) {
|
||||
return mssql_query($sql, $this->connection);
|
||||
$result = @mssql_query($sql, $this->connection);
|
||||
$this->__lastQueryHadError = ($result === false);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -424,10 +433,9 @@ class DboMssql extends DboSource {
|
|||
* @return string Error message with error number
|
||||
*/
|
||||
function lastError() {
|
||||
$error = mssql_get_last_message();
|
||||
|
||||
if ($error) {
|
||||
if (!preg_match('/contexto de la base de datos a|contesto di database|changed database|contexte de la base de don|datenbankkontext/i', $error)) {
|
||||
if ($this->__lastQueryHadError) {
|
||||
$error = mssql_get_last_message();
|
||||
if ($error && !preg_match('/contexto de la base de datos a|contesto di database|changed database|contexte de la base de don|datenbankkontext/i', $error)) {
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -469,6 +469,12 @@ class DboSource extends DataSource {
|
|||
* @access public
|
||||
*/
|
||||
function name($data) {
|
||||
if (is_object($data) && isset($data->type)) {
|
||||
return $data->value;
|
||||
}
|
||||
if ($data == '*') {
|
||||
return '*';
|
||||
}
|
||||
if ($data === '*') {
|
||||
return '*';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue