Make functions_mysql.php into a semi-product-merged version of IO/Util.php

This reduces the code in the functions themselves, but makes them dependent on an outide mysql $link
I removed the connection checks because that already happens at link time in index.php