mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding field quoting fix in DboSource::name() (Ticket #2300)
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4697 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
7b1f458b0f
commit
8b7f46acaa
2 changed files with 5 additions and 2 deletions
|
@ -382,10 +382,10 @@ class DboSource extends DataSource {
|
|||
* @return string SQL field
|
||||
*/
|
||||
function name($data) {
|
||||
if (preg_match_all('/(.*)\((.*)\)/', $data, $fields)) {
|
||||
if (preg_match_all('/(.*)\((.*)\)(.*)/', $data, $fields)) {
|
||||
$fields = Set::extract($fields, '{n}.0');
|
||||
if (isset($fields[1]) && isset($fields[2])) {
|
||||
return $fields[1] . '(' . $this->name($fields[2]) . ')';
|
||||
return $fields[1] . '(' . $this->name($fields[2]) . ')' . $fields[3];
|
||||
}
|
||||
}
|
||||
if ($data == '*') {
|
||||
|
|
|
@ -940,6 +940,9 @@ class DboSourceTest extends UnitTestCase {
|
|||
|
||||
$result = $this->db->conditions(array(array('Project.removed' => null)));
|
||||
$this->assertPattern('/^\s*WHERE\s+`Project`.`removed`\s+IS\s+NULL\s*$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('(Usergroup.permissions) & 4' => 4));
|
||||
$this->assertPattern('/^\s*WHERE\s+\(`Usergroup`\.`permissions`\)\s+& 4\s+=\s+4\s*$/', $result);
|
||||
}
|
||||
|
||||
function testFieldParsing() {
|
||||
|
|
Loading…
Add table
Reference in a new issue