Updating Database and Transaction States.

Added a flag to keep track of transactional states in order to prevent exception throwing, and set Database to extend PDO instead of holding a reference object inside of it.