[Typo3-dev] RFC: TYPO3, Kickstarter and M-M database relations
Jan-Erik Revsbech
jer at moccompany.com
Fri Oct 7 09:08:24 CEST 2005
>> How would I do a like query on this one to look for number for UID 1?
>
> Now that you mention it, I remember that I didn't use LIKE, LIKE
> couldn't do that particular task,
That is not true. Making af call to
$GLOBALS['TYPO3_DB']->listQuery($field,$value,$table) will return you
($field LIKE "%$value,%" OR $field LIKE "%$,value%" OR $field =$value)
In the above case ($field LIKE "%1,%" OR $field LIKE "%$,1%" OR $field =1)
which will do the trick. And it is up to DBAL($GLBOALS['TYPO3_DB']) to make
WHERE clause that will work on a particular database. Alternativley you
could use the MySQL function FIND_IN_SET which alow works, but is not SQL
standard.
I do agree however, that MM tables are much better. In a specific example we
had 22.000 BE usergroups nested into eachother (child-parent relation is a
comma list in table be_groups), and it was very clear that all queries on
the be_groups table were significantly slowing down the system. We changed
to mm relation instead and now everything worked fine. I agree that we
should try to avoid have to many comma list in the core, but I agree that is
is a big task.
/Jan-Erik
More information about the TYPO3-dev
mailing list