[BUGFIX] dbal: Cast field to CHAR for FIND_IN_SET() 79/39779/8
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Thu, 28 May 2015 17:50:47 +0000 (19:50 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 22 Jul 2015 16:50:41 +0000 (18:50 +0200)
commit14f04a6a526ce654c86e7e62bcf4cb09cfca6eb2
tree883988131553eb72fb71bfbcff386e5f42534846
parent08a1173c68ef8f63d9c2fad55e4d0977499b3b83
[BUGFIX] dbal: Cast field to CHAR for FIND_IN_SET()

Implement explicit casting of fields to a character representation.
Most DBMS are stricter in regard to data type checking and emit an
error when trying to use FIND_IN_SET() on non-text field types.

On the DBAL side of things the DBMS specifics are used to define that
an explicit cast is required for FIND_IN_SET() so that a query including
the CAST() statement gets generated.

A PostgreSQL Specific has been added to enable the explicit casting in
conjuction with DBAL. To avoid checking repeatedly if a DBMS has defined
specific requirements a NullSpecific has been implemented that gets used
as a default.

In the DatabaseTreeDataProvider the listFieldQuery() function has been
changed to use an explicit CAST() instead of relying on the implicit
cast done by MySQL when comparing it to an empty string.

The SqlParser has been extended with the support for CAST().

Resolves: #67155
Resolves: #67172
Resolves: #46271
Releases: master, 6.2
Change-Id: Ic77d1700e0fb4e3723c90b34e131dafb456038e0
Reviewed-on: http://review.typo3.org/39779
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Database/SqlParser.php
typo3/sysext/core/Classes/Tree/TableConfiguration/DatabaseTreeDataProvider.php
typo3/sysext/core/Tests/Unit/Database/SqlParserTest.php
typo3/sysext/dbal/Classes/Database/DatabaseConnection.php
typo3/sysext/dbal/Classes/Database/Specifics/AbstractSpecifics.php
typo3/sysext/dbal/Classes/Database/Specifics/PostgresSpecifics.php
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionPostgresqlTest.php
typo3/sysext/dbal/Tests/Unit/Database/SqlParserTest.php