Fix issue with old MySQL databases

Older MySQL databases doesn't seem to be able to handle large numbers
like an IPv6 address in integer format. Quoted all queries that could
hold such large numbers.