mysql functions and transactions.