A very elegant way might be storing your query strings in an own table of the database. Then you can for example SELECT query_string FROM queries WHERE action = 'store_product'. You might even use this approach to store different parts of the query string in different tables and use a join to parametrize your queries within a set of known ones. (This is an idea I picked up here on PM; see Re: Eliminating Dynamic SQL... for the original writeup.)