Fixed #32489 : Database prefix did not work if first in string or not first in quotes

This is an important fix for 3.2.0 stable.

Tracker item:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_id=8103&tracker_item_id=32489