user3332010
user3332010

Reputation: 165

TYPO3 queryBuilder: How to work with BINARY in where() clause?

There's no description in the following API overview of TYPO3 how to use a "BINARY" in where() clause: https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Database/QueryBuilder/Index.html#expr

What I want to achieve? this one:

WHERE BINARY `buyer_code` = "f#F67d";

Actually I can only do the following:

->where(
  $queryBuilder->expr()->eq('buyer_code', 'f#F67d')
);

But in this case I don't get a satisfying result for myself because I need case-sensitive here :-)

An another buyer_code exists "f#F67D" (the last char is uppercase) but I do need to look for the other one.

Upvotes: 0

Views: 301

Answers (2)

Julian Hofmann
Julian Hofmann

Reputation: 2592

Please have a look at Doctrine2 case-sensitive query The thread is a bit older, but seems to cover background and solution for your problem.

Upvotes: 0

Euli
Euli

Reputation: 1143

Since TYPO3 is using Doctrine API here, you could try to do

->where('BINARY `buyer_code` = ' . $queryBuilder->createNamedParameter('f#F67d'))

Please keep in mind, that this query now only works for database backends, supporting the BINARY keyword!

Upvotes: 0

Related Questions