[TYPO3-core] FYI #13104: SQL parser cannot parse escaped single quote in INSERT statement

Xavier Perseguers typo3 at perseguers.ch
Mon Dec 28 01:57:18 CET 2009


FYI: the attached patches were committed to:

- DBAL trunk (rev. 28103)
- DBAL_1-0 (rev. 28105)
- Core trunk (rev. 6704)
- Core TYPO3_4-3 (rev. 6705)

Type: Bugfix

Bugtracker reference:

Trunk and 4.3

When trying to import static data from EXT:static_info_tables, the script dies with typical error:

ERROR: Query could not be parsed: "SQL engine parse ERROR: No ) parenthesis in list: near "Andorra', 'Principality of Andorra', 'Andorra la Vella', 'ad', 'EUR', '978', '376', '0', '1', '0', 'Andorra', 
'Andorra', '1') "". Query: "INSERT INTO static_countries VALUES ('1', '0', '0', 'AD', 'AND', '20', '39', 'Principat d\'Andorra', 'Principality of Andorra', 'Andorra la Vella', 'ad', 'EUR', '978', 
'376', '0', '1', '0', 'Andorra', 'Andorra', '1');"

This is cause by the escaped single quote in "Principat d\'Andorra"

Fix SQL parser to support escaped single quotes

- Chunk #1 of Core patch is a follow-up of revision 5424 where ereg_* methods were replaced by preg_match. The resulting code did not work as expected
- Chunk #2 of Core patch kind of a follow-up of revision 528 (!) where Kasper committed a few patches from Karsten. I always found it weird to have this wrongly indented return statement without 
explanation. I now understand why it was needed and preferred to remove it to have a clean t3lib_sqlparser and override it in ux_t3lib_sqlparser where it actually should return the input string as-this
- Unit tests were added to DBAL as usual

Xavier Perseguers

One contribution a day keeps the fork away
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 13104_core.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091228/9f0ca330/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 13104_dbal.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091228/9f0ca330/attachment.asc>

More information about the TYPO3-team-core mailing list