Ensure set_prepare_statement is called once only per query_id