Project

General

Profile

Actions

Feature #23087

closed

FIND_IN_SET should be used instead of complicated LIKE where clause

Added by Xavier Perseguers over 14 years ago. Updated almost 14 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2010-07-03
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

MySQL supports the FIND_IN_SET operator to efficiently find records having a given value in a set of values (comma-separated list of values). This is typically used with usergroups. This method should be used instead of doing some complicated LIKE query.

Solution:
Enhance the SQL query to support this operator and rewrite it if needed for other DBMS. Use a dedicated DBMS function whenever possible (PostgreSQL / MSSQL). For instance:

MSSQL: http://mschat.net/blog/index.php?topic=8
PostgreSQL: http://archives.postgresql.org/pgsql-sql/2009-12/msg00033.php

(issue imported from #M14985)


Files

14985_core.diff (2.45 KB) 14985_core.diff Administrator Admin, 2010-07-03 17:43
14985_dbal.diff (9.92 KB) 14985_dbal.diff Administrator Admin, 2010-07-03 17:43
14985_core_v2.diff (2.44 KB) 14985_core_v2.diff Administrator Admin, 2010-07-16 15:18
14985_dbal_v2.diff (9.63 KB) 14985_dbal_v2.diff Administrator Admin, 2010-07-16 15:18

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #22959: t3lib_db->listQuery() performanceClosedXavier Perseguers2010-06-22

Actions
Actions #1

Updated by Xavier Perseguers over 14 years ago

PostgreSQL compatibility function was provided by R. van Twisk over Skype during T3DD10. Thank you!

Actions #2

Updated by Xavier Perseguers over 14 years ago

For Oracle the big LIKE clause should be replaced by:

WHERE ',' || field || ',' LIKE '%,11,%'

Actions #3

Updated by Xavier Perseguers over 14 years ago

Compatibility function for MSSQL does not work great and furthermore function call in MSSQL needs to be "user"-prefixed, that's not yet supported by DBAL => use same method as my comment #40348, with "+" instead of "||"

Actions #4

Updated by Xavier Perseguers over 14 years ago

Committed to:

- Core trunk (rev. 8196)
- DBAL trunk (rev. 35742)

Actions

Also available in: Atom PDF