[BUGFIX] dbal: Cast field to CHAR for FIND_IN_SET() 42/41842/2
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 18:23:29 +0000 (20:23 +0200)
commita780e46ad709bcf5df9253182c620cec8c748bc4
tree37041f8cb3820ee27d5c175076b790a65aa3f32c
parent59dbf92134010068faf481b9a74ecdcad956c3d3
[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>
Reviewed-on: http://review.typo3.org/41842
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/Postgres.php [new file with mode: 0644]
typo3/sysext/dbal/Tests/Unit/Database/DatabaseConnectionPostgresqlTest.php
typo3/sysext/dbal/Tests/Unit/Database/SqlParserTest.php