[TASK] Follow-up: Use prepared statements in generic persistence

Fixes using $query->statement() without parameters.

Resolves: #56915
Resolves: #55360
Releases: 6.2
Change-Id: Ia149313f5f9f719d7dba0a21a3eb39ea4f5052e8
Reviewed-on: https://review.typo3.org/28442
Reviewed-by: Markus Klein
Reviewed-by: Dennis J
Tested-by: Dennis J
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters