[TYPO3-dev] How standard compliant is "truncate"?

ries van Twisk typo3 at rvt.dds.nl
Thu Feb 5 13:01:00 CET 2009


On Feb 5, 2009, at 6:51 AM, Peter Kuehn [wmdb] wrote:

> Martin Kutschker schrieb:
>
>> We could add a simple wrapper in t3lib_db.
>
> exec_TRUNCATEquery($table) that checks
>  if running on mysql
>   use "truncate"
>   else "delete from without where"
> ?
>
> id love to have that one - would even be cool for cli-importers and
> stuff where i frequently have to clear tmp-tables.
> gRTz
> pekue

You only need to pass an Array of tables in the case you want to  
truncate
more then one table. The reason is because of possible foreign  
references
that will not be checked and if found the truncate will not be executed.
Now I know that this doesn't really count for TYPO3 but the API should  
be correct.

Ries











More information about the TYPO3-dev mailing list