[BUGFIX] Follow up: Use strrpos to find last occurence

The patch #61654 introduced a bug, where strpos is mistakenly
used to get the last position of the currently processed field.
It must be changed to strrpos, otherwise the opening brace
breaks the SQL.

Also, a unit test for this case is added.

Resolves: #63345
Related: #61654
Releases: master, 6.2
Change-Id: Ibdbc7975b8f750060980f811cd0089b1a7b7de2b
Reviewed-on: http://review.typo3.org/34682
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>