[TYPO3-core] RFC #14818: Performance: Use mysql find_in_set-function in t3lib_db->listQuery()
Xavier Perseguers
typo3 at perseguers.ch
Sun Jul 4 11:48:20 CEST 2010
Hi,
>> I had a small discussion with Xavier this morning about
>> a find_in_set compatible function for PostgreSQL.
>>
>> Is it possible that the functions get's changed to :
>>
>> $where = 'find_in_set(\'' . $pattern . '\',' . $field . ') != 0';
>>
>> The rationale behind this is that it's easer to port
>> this function to other databases because for example
>> PostgreSQL 'wants' a boolean evaluation, and mysql
>> fakes integer for boolean, a bit like what PHP does (incorect IMHO).
>> It's also to show other people reading the code the correct way to do
>> it.
>>
>> However, I leave the final decision up to you and Xavier (or others).
Well, I prepared the patch to automatically add "= 1" for MSSQL
compatibility function and "!= 0" for PostgreSQL when using DBAL. I
don't know exactly what's the best solution here because it mainly aims
at being the most compatible with MySQL and the use of it.
However as our compatibility functions for MSSQL and PostgreSQL are not
100% the same as the MySQL one (it basically returns true or false but
not the actual position of the item in the list, which should be OK I
guess with our use in TYPO3), forcing the user to add "!= 0" would be
better. I'll change the DBAL patch to not automatically add this
comparison string (see related issue in bug tracker if you're interested
in).
> I have checked the changed function and I found no reason why we should
> not use it this way.
>
> Due to the fact that the find_in_list function does not work properly if
> the value contains a comma (,), I have added an InvalidArgumentException
> to the listQuery()
Good idea!
It's last morning of T3DD10, I'll be flying home this afternoon and have
a look at it next week. Basically I agree on this patch but would like
to commit the DBAL part at the same time in order to let people using
TYPO3 trunk with another DBMS to be able to checkout DBAL trunk and keep
their install working. For this I'll have to test my DBAL patch on other
DBMS first.
Thanks to both of you, Caspar and Ries, for your work.
Xavier
More information about the TYPO3-team-core
mailing list