BUG/TST: Fix io.sql.write_frame replace bug and complete test coverage of if_exists functionality 

This fixes #2971 and #4110.  This also provides test coverage for the different values for the if_exists argument for io.sql.write_frame.