Extracting the mysql functions to make using another database easier.