Fixed several database bugs
Fixed bug where errors would not be returned if transaction was rolled back.
Moved from multi_query to real_query as no code now relies on running multiple queries in one block.
- As a result, moved to using transaction methods rather than wrapping code block in transaction sql.