A Generic Provenance Middleware for Queries, Updates, and Transactions