Getting ready for change to mysqli.

Added a few proxy methods not to call some functions directly. Changed
the code a bit to remove all usages of mysql_fetch_array, using own
query_row or query_rows proxy methods instead. Seemed to be working at
first glimpse.