Project

General

Profile

Bug #22104 » 13504_dbal_followup.diff

Administrator Admin, 2010-02-11 19:44

View differences:

class.ux_t3lib_db.php (working copy)
* @param string Database tablename
* @return mixed Result from handler
*/
public function exec_TRUNCATETABLEquery($table) {
public function exec_TRUNCATEquery($table) {
if ($this->debug) {
$pt = t3lib_div::milliseconds();
}
......
$this->lastHandlerKey = $this->handler_getFromTableList($ORIG_tableName);
switch ((string)$this->handlerCfg[$this->lastHandlerKey]['type']) {
case 'native':
$this->lastQuery = $this->TRUNCATETABLEquery($table);
$this->lastQuery = $this->TRUNCATEquery($table);
$sqlResult = mysql_query($this->lastQuery, $this->handlerInstance[$this->lastHandlerKey]['link']);
break;
case 'adodb':
$this->lastQuery = $this->TRUNCATETABLEquery($table);
$this->lastQuery = $this->TRUNCATEquery($table);
$sqlResult = $this->handlerInstance[$this->lastHandlerKey]->_query($this->lastQuery, FALSE);
break;
case 'userdefined':
$sqlResult = $this->handlerInstance[$this->lastHandlerKey]->exec_TRUNCATETABLEquery($table,$where);
$sqlResult = $this->handlerInstance[$this->lastHandlerKey]->exec_TRUNCATEquery($table,$where);
break;
}
......
if ($this->debug) {
$this->debugHandler(
'exec_TRUNCATETABLEquery',
'exec_TRUNCATEquery',
t3lib_div::milliseconds() - $pt,
array(
'handlerType' => $hType,
......
case 'TRUNCATETABLE':
$table = $queryParts['TABLE'];
return $this->exec_TRUNCATETABLEquery($table);
return $this->exec_TRUNCATEquery($table);
}
}
......
/**
* Creates a TRUNCATE TABLE SQL-statement
*
* @param string See exec_TRUNCATETABLEquery()
* @param string See exec_TRUNCATEquery()
* @return string Full SQL query for TRUNCATE TABLE
*/
public function TRUNCATETABLEquery($table) {
public function TRUNCATEquery($table) {
$table = $this->quoteFromTables($table);
// Call parent method to build actual query
$query = parent::TRUNCATETABLEquery($table);
$query = parent::TRUNCATEquery($table);
if ($this->debugOutput || $this->store_lastBuiltQuery) {
$this->debug_lastBuiltQuery = $query;
......
case 'INSERT':
return $this->exec_INSERTquery($this->lastParsedAndMappedQueryArray['TABLE'], $compiledQuery);
case 'TRUNCATETABLE':
return $this->exec_TRUNCATETABLEquery($this->lastParsedAndMappedQueryArray['TABLE']);
return $this->exec_TRUNCATEquery($this->lastParsedAndMappedQueryArray['TABLE']);
}
return $this->handlerInstance[$this->lastHandlerKey]->DataDictionary->ExecuteSQLArray($compiledQuery);
break;
tests/db_oracle_testcase.php (working copy)
* @test
* http://bugs.typo3.org/view.php?id=13504
*/
public function truncateTableQueryIsProperlyQuoted() {
$query = $this->cleanSql($GLOBALS['TYPO3_DB']->TRUNCATETABLEquery('be_users'));
public function truncateQueryIsProperlyQuoted() {
$query = $this->cleanSql($GLOBALS['TYPO3_DB']->TRUNCATEquery('be_users'));
$expected = 'TRUNCATE TABLE "be_users"';
$this->assertEquals($expected, $query);
}
(5-5/5)