[TYPO3-dev] A way to detect if table has a certain field

Tapio Markula tapio.markula at xetpoint.fi
Thu Sep 27 16:45:03 CEST 2007


Oliver Hader kirjoitti:
> Hi Tapio,
> 
> Tapio Markula schrieb:
>> Is there any core function to detect if the table has certain field.
>> I would need to know if table has fieds 'pid' and 'deleted'
> 
> If the field is defined in $TCA you could do:
> t3lib_div::loadTCA('myTable');
> if (isset($GLOBALS['TCA']['myTable']['columns']['myField'])) {
> 	// Field 'myField' of table 'myTable' was defined in $TCA
> }

there is *newer* TCA for uid,pid and deleted - they are handled always 
internally.

> DESCRIBE myTable myField
> If the field is found, there'll be a result row.
which MySQL supports that?

what Typo3 call I could use?
I mean something like
$GLOBALS['TYPO3_DB']->exec_SELECTquery('COUNT(*)',$table,'pid='.$id.' 
AND deleted=0','', '', '');




More information about the TYPO3-dev mailing list