How about using stored procedures? All the sql lives on the database and you only call the name of the procedure and pass the parameters.