Bug #63275

Typo3DbQueryParser generates broken SQL for array in CONTAINS-comparison

Added by Stefan Neufeind about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Category:
Extbase
Target version:
-
Start date:
2014-11-23
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When passing an array for a "contains"-comparison Typo3DbQueryParser generates SQL like:

[...] FROM  sys_category_record_mm WHERE uid_local='1','3' AND tablenames = [...]

which simply needs an "IN" statement for the operand2.


Related issues

Related to TYPO3 Core - Bug #64044: Revert fix for #63275 until concept is worked out and agreed upon Closed 2014-12-26
Duplicates TYPO3 Core - Feature #7848: Support array / multiple values in $query->contains Closed 2010-05-21 2010-06-04

Associated revisions

Revision e235c9ad (diff)
Added by Stefan Neufeind about 4 years ago

[BUGFIX] Typo3DbQueryParser: Use IN with array-operand2

When passing an array for a "contains"-comparison
Typo3DbQueryParser generates SQL like
[...] WHERE uid_local='1','3' [...]
which simply needs an "IN" statement for the operand2.

Change-Id: Id3a6e73dcbd55d46a5279037b156f604dafa9888
Resolves: #63275
Releases: master, 6.2
Reviewed-on: http://review.typo3.org/34514
Reviewed-by: Mathias Schreiber <>
Tested-by: Mathias Schreiber <>
Reviewed-by: Frank Nägler <>
Tested-by: Frank Nägler <>

History

#1 Updated by Gerrit Code Review about 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34514

#2 Updated by Stefan Neufeind about 4 years ago

  • TYPO3 Version changed from 7 to 6.2

Example-code to test with:
public function listAction() {
$catA = $this->categoryRepository->findByTitle('CatA')->getFirst();
$catC = $this->categoryRepository->findByTitle('CatC')->getFirst();
$query = $this->myrecordRepository->createQuery();
$myrecords = $query->matching(
$query->contains('categories', array($catA->getUid(), $catC->getUid()))
)->execute();
$this->view->assign('myrecords', $myrecords);
}

#3 Updated by Gerrit Code Review about 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34514

#4 Updated by Gerrit Code Review about 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34514

#5 Updated by Gerrit Code Review about 4 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34514

#6 Updated by Gerrit Code Review about 4 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34514

#7 Updated by Gerrit Code Review about 4 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35646

#8 Updated by Stefan Neufeind about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#9 Updated by Gerrit Code Review about 4 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35646

#10 Updated by Helmut Hummel about 4 years ago

  • Status changed from Under Review to Closed

This is a duplicate of #7848

Discussion should continue there

Also available in: Atom PDF