typo3builderconnection-pool

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


I just have a short question.

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:

WEHRE 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.

Thanks for helping.


Solution

  • 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!