Issue Bug Closed

#21797SQL error in translationCount() if table does not provide deleted field

Kurt Gusbeth 12/04/09, 17:20 updated 07/02/10, 11:17

Description

Like you can see at “Additional Information”, you will get a MySQL-Error message when there is no deleted-field in a table.
This is the error-message I get:

t3lib_DB::exec_SELECTquery
ERROR
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘=0’ at line 1
lastBuiltQuery
SELECT COUNT FROM tx_myquizpoll_result WHERE l10n_parent=100 AND sys_language_uid!=0 AND =0

I didn´t get this error message in typo3 version 4.2.10 !
Please check if $GLOBALS[‘TCA’][$table][‘ctrl’][‘delete’] is set !

public static function translationCount($table, $ref, $msg = ‘’) {
if (empty($GLOBALS[‘TCA’][$table][‘ctrl’][‘transForeignTable’]) &&
$GLOBALS[‘TCA’][$table][‘ctrl’][‘languageField’] &&
$GLOBALS[‘TCA’][$table][‘ctrl’][‘transOrigPointerField’] &&
!$GLOBALS[‘TCA’][$table][‘ctrl’][‘transOrigPointerTable’]) {
$count = $GLOBALS[‘TYPO3_DB’]->exec_SELECTcountRows(
‘*’,
$table,
$GLOBALS[‘TCA’][$table][‘ctrl’][‘transOrigPointerField’] . ‘=’ . intval($ref) .
‘ AND ‘ . $GLOBALS[‘TCA’][$table][‘ctrl’][‘languageField’] . ‘!=0’
‘ AND ‘ . $GLOBALS[‘TCA’][$table][‘ctrl’][‘delete’] . ‘=0’
);
}
    return ($count ? ($msg ? sprintf($msg, $count) : $count) : ‘’);
}
(issue imported from #M12928)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.