Project

General

Profile

Bug #21718 » 12800-core.diff

Administrator Admin, 2009-11-29 13:55

View differences:

t3lib/class.t3lib_db.php (working copy)
}
/**
* Creates a SELECT SQL-statement to be used as subquery within another query.
* BEWARE: This method should not be overriden within DBAL to prevent quoting from happening.
*
* @param string $select_fields
* @param string $from_table
* @param string $where_clause
* @return string Full SQL query for SELECT
*/
public function SELECTsubquery($select_fields, $from_table, $where_clause) {
// Table and fieldnames should be "SQL-injection-safe" when supplied to this function
// Build basic query:
$query = 'SELECT ' . $select_fields . ' FROM ' . $from_table .
(strlen($where_clause) > 0 ? ' WHERE ' . $where_clause : '');
// Return query:
if ($this->debugOutput || $this->store_lastBuiltQuery) {
$this->debug_lastBuiltQuery = $query;
}
return $query;
}
/**
* Returns a WHERE clause that can find a value ($value) in a list field ($field)
* For instance a record in the database might contain a list of numbers,
* "34,234,5" (with no spaces between). This query would be able to select that
t3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php (working copy)
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->cacheTable,
'identifier IN (' .
$GLOBALS['TYPO3_DB']->SELECTquery(
$GLOBALS['TYPO3_DB']->SELECTsubquery(
'identifier',
$this->tagsTable,
$this->getQueryForTag($tag)
......
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->cacheTable,
'identifier IN (' .
$GLOBALS['TYPO3_DB']->SELECTquery(
$GLOBALS['TYPO3_DB']->SELECTsubquery(
'identifier',
$this->tagsTable,
implode(' OR ', $listQueryConditions)
......
$GLOBALS['TYPO3_DB']->exec_DELETEquery(
$this->tagsTable,
'identifier IN (' .
$GLOBALS['TYPO3_DB']->SELECTquery(
$GLOBALS['TYPO3_DB']->SELECTsubquery(
'identifier',
$this->cacheTable,
'crdate + lifetime < ' . $GLOBALS['EXEC_TIME'] . ' AND lifetime > 0'
t3lib/class.t3lib_sqlparser.php (working copy)
}
} else return $this->parseError('No table to select from!',$parseString);
// Store current parseString in the result array for possible further processing (e.g., subquery support by DBAL)
$result['parseString'] = $parseString;
// Return result:
return $result;
}
(2-2/3)