[1.6.x] Fixed #14786 -- Fixed get_db_prep_lookup calling get_prep_value twice if prepared is False.

Thanks homm for the report and Aramgutang and lrekucki for work on
the patch.

Backport of f19a3669b8 from master