OC_DB::prepare seems unneeded because this gets called inside of executeAudited https://github.com/owncloud/core/blob/master/lib/db.php#L445

(You already changed that in the above sql statements)