[TYPO3-dev] strange enableFields SQL with T3 4.0
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Wed Apr 12 09:40:24 CEST 2006
Jan-Hendrik Heuing [DD] schrieb:
> Hi!
>
> Just had a look at the new version including some PHP, I stumbled across
> some strange SQL. Well, it is working, but it could be much simpler if I am
> right...
>
> ....(tx_ddblog_entries.fe_group LIKE '%,-2,%' OR tx_ddblog_entries.fe_group
> LIKE '-2,%' OR tx_ddblog_entries.fe_group LIKE '%,-2' OR
> tx_ddblog_entries.fe_group='-2')...
>
> Some CONCAT statement should do that all at once, before I submit some
> changes, is there any reason why it is done this way?
What would a CONCAT do? The statement above tests if fe_group starts with
-2, ends with -2 has a -2 in it or is -2.
A CONCAT won't help but using 3NF would. Or you use Mysql's FIND_IN_SET
function: FIND_IN_SET('-2',tx_ddblog_entries.fe_group)
Since Mysql is prime database for Mysql and practically all others have
stored procedures we could define a set of Mysql feaures like FIND_IN_SET
that have to be present or emulated via stored procedures for other DBs.
Masi
More information about the TYPO3-dev
mailing list