Index: t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php =================================================================== --- t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php (revision 5385) +++ t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php (working copy) @@ -93,7 +93,7 @@ 'content', $this->cacheTable, 'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' ' - . 'AND ((crdate + lifetime) >= ' . time() . ' OR lifetime = 0)' + . 'AND (crdate + lifetime >= ' . time() . ' OR lifetime = 0)' ); if (count($cacheEntries) == 1) { @@ -117,7 +117,7 @@ 'content', $this->cacheTable, 'identifier = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($entryIdentifier, $this->cacheTable) . ' ' - . 'AND (crdate + lifetime) >= ' . time() + . 'AND crdate + lifetime >= ' . time() ); if (count($cacheEntries) == 1) { @@ -163,7 +163,7 @@ $cacheEntryIdentifierRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 'identifier', $this->cacheTable, - $this->getListQueryForTag($tag) . ' AND ((crdate + lifetime) >= ' . time() . ' OR lifetime = 0)' + $this->getListQueryForTag($tag) . ' AND (crdate + lifetime >= ' . time() . ' OR lifetime = 0)' ); foreach ($cacheEntryIdentifierRows as $cacheEntryIdentifierRow) { @@ -188,7 +188,7 @@ foreach ($tags as $tag) { $whereClause[] = $this->getListQueryForTag($tag); } - $whereClause[] = '((crdate + lifetime) >= ' . time() . ' OR lifetime = 0)'; + $whereClause[] = '(crdate + lifetime >= ' . time() . ' OR lifetime = 0)'; $cacheEntryIdentifierRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 'identifier', @@ -248,7 +248,7 @@ public function collectGarbage() { $GLOBALS['TYPO3_DB']->exec_DELETEquery( $this->cacheTable, - '(crdate + lifetime) < ' . time() + 'crdate + lifetime < ' . time() ); } @@ -321,4 +321,4 @@ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php']); } -?> \ No newline at end of file +?> Index: t3lib/class.t3lib_sqlparser.php =================================================================== --- t3lib/class.t3lib_sqlparser.php (revision 5385) +++ t3lib/class.t3lib_sqlparser.php (working copy) @@ -905,8 +905,17 @@ // Find "modifyer", eg. "NOT or !" $stack[$level][$pnt[$level]]['modifier'] = trim($this->nextPart($parseString,'^(!|NOT[[:space:]]+)')); + // Support calculated value only for: + // - "&" (boolean AND) + // - "+" (addition) + // - "-" (substraction) + // - "*" (multiplication) + // - "/" (division) + // - "%" (modulo) + $calcOperators = '&|\+|-|\*|\/|%'; + // Fieldname: - if ($fieldName = $this->nextPart($parseString,'^([[:alnum:]._]+)([[:space:]]+|&|<=|>=|<|>|=|!=|IS)')) { + if ($fieldName = $this->nextPart($parseString, '^([[:alnum:]._]+)([[:space:]]+|' . $calcOperators . '|<=|>=|<|>|=|!=|IS)')) { // Parse field name into field and table: $tableField = explode('.',$fieldName,2); @@ -921,8 +930,8 @@ return $this->parseError('No field name found as expected in parseWhereClause()',$parseString); } - // See if the value is calculated. Support only for "&" (boolean AND) at the moment: - $stack[$level][$pnt[$level]]['calc'] = $this->nextPart($parseString,'^(&)'); + // See if the value is calculated: + $stack[$level][$pnt[$level]]['calc'] = $this->nextPart($parseString, '^(' . $calcOperators . ')'); if (strlen($stack[$level][$pnt[$level]]['calc'])) { // Finding value for calculation: $stack[$level][$pnt[$level]]['calc_value'] = $this->getValue($parseString); @@ -953,8 +962,10 @@ } // Detecting the operator for the next level: - $op = $this->nextPart($parseString,'^(AND[[:space:]]+NOT|OR[[:space:]]+NOT|AND|OR)(\(|[[:space:]]+)'); - if ($op) { + $op = $this->nextPart($parseString, '^(AND[[:space:]]+NOT|&&[[:space:]]+NOT|OR[[:space:]]+NOT|OR[[:space:]]+NOT|\|\|[[:space:]]+NOT|AND|&&|OR|\|\|)(\(|[[:space:]]+)'); + if ($op) { + // Normalize boolean operator + $op = str_replace(array('&&', '||'), array('AND', 'OR'), $op); $stack[$level][$pnt[$level]]['operator'] = $op; } elseif (strlen($parseString)) { @@ -1741,4 +1752,4 @@ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlparser.php']); } -?> \ No newline at end of file +?> Index: typo3/sysext/dbal/class.ux_t3lib_sqlparser.php =================================================================== --- typo3/sysext/dbal/class.ux_t3lib_sqlparser.php (revision 5385) +++ typo3/sysext/dbal/class.ux_t3lib_sqlparser.php (working copy) @@ -302,8 +302,13 @@ /** * Implodes an array of WHERE clause configuration into a WHERE clause. * - * DBAL-specific: The only(!) handled "calc" operator supported by parseWhereClause() is the bitwise - * logical and (&), and only this one is supported here! + * DBAL-specific: The only(!) handled "calc" operators supported by parseWhereClause() are: + * - the bitwise logical and (&) + * - the addition (+) + * - the substraction (-) + * - the multiplication (*) + * - the division (/) + * - the modulo (%) * * @param array WHERE clause configuration * @return string WHERE clause as string. @@ -334,7 +339,7 @@ $output.=' '.trim($v['modifier']).' '; // DBAL-specific: Set calculation, if any: - if ($v['calc'] && $functionMapping) { + if ($v['calc'] === '&' && $functionMapping) { switch(true) { case $GLOBALS['TYPO3_DB']->runningADOdbDriver('oci8'): // Oracle only knows BITAND(x,y) - sigh @@ -387,4 +392,4 @@ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/class.ux_t3lib_sqlparser.php']); } -?> \ No newline at end of file +?>