Bug #17552 » 6196_core.diff
t3lib/class.t3lib_sqlparser.php (working copy) | ||
---|---|---|
}
|
||
if (!$this->nextPart($parseString, '^([)])')) {
|
||
return $this->parseError('No ) parenthesis at end of function');
|
||
}
|
||
}
|
||
} elseif (preg_match('/^IFNULL[[:space:]]*[(]/i', $parseString)) {
|
||
$stack[$level][$pnt[$level]]['func']['type'] = $this->nextPart($parseString, '^(IFNULL)[[:space:]]*');
|
||
$parseString = trim(substr($parseString, 1)); // Strip of "("
|
||
if ($fieldName = $this->nextPart($parseString, '^([[:alnum:]\*._]+)[[:space:]]*')) {
|
||
|
||
// Parse field name into field and table:
|
||
$tableField = explode('.', $fieldName, 2);
|
||
if (count($tableField) == 2) {
|
||
$stack[$level][$pnt[$level]]['func']['table'] = $tableField[0];
|
||
$stack[$level][$pnt[$level]]['func']['field'] = $tableField[1];
|
||
} else {
|
||
$stack[$level][$pnt[$level]]['func']['table'] = '';
|
||
$stack[$level][$pnt[$level]]['func']['field'] = $tableField[0];
|
||
}
|
||
} else {
|
||
return $this->parseError('No field name found as expected in parseWhereClause()', $parseString);
|
||
}
|
||
if ($this->nextPart($parseString, '^(,)')) {
|
||
$stack[$level][$pnt[$level]]['func']['default'] = $this->getValue($parseString);
|
||
}
|
||
if (!$this->nextPart($parseString, '^([)])')) {
|
||
return $this->parseError('No ) parenthesis at end of function');
|
||
}
|
||
} else {
|
||
// Support calculated value only for:
|
||
... | ... | |
$output .= ', ' . ($v['func']['table'] ? $v['func']['table'] . '.' : '') . $v['func']['field'];
|
||
$output .= isset($v['func']['pos']) ? ', ' . $v['func']['pos'][0] : '';
|
||
$output .= ')';
|
||
} elseif (isset($v['func']) && $v['func']['type'] === 'IFNULL') {
|
||
$output = ' ' . trim($v['modifier']) . ' IFNULL(';
|
||
$output .= ($v['func']['table'] ? $v['func']['table'] . '.' : '') . $v['func']['field'];
|
||
$output .= ', ' . $v['func']['default'][1] . $this->compileAddslashes($v['func']['default'][0]) . $v['func']['default'][1];
|
||
$output .= ')';
|
||
} else {
|
||
|
||
// Set field/table with modifying prefix if any:
|