Add missing queryinterface/addref default implementations.
Add and use sql_def_{lock,unlock,trylock}_()
Add sql_mysql_escape_()
Add sql_escape(), minor tidy-up of sql_mysql_escape_()