I have a multitude of functions which insert different data into several tables. In some cases, for all functions, a staff ID column will need to be populated. Since all of the data inserting functions return the ID of the inserted row, I could do set_staff_id(staff_id, insert_data1(...)); Instead of adding an optional staff_id argument to all data inserting functions, and coppying the set staff_id code too.
I'm trying to avoid code duplication, but wonder if this is the correct aproach. Thanks.