apply functions to each row or entire result set