_db = Database_Connection::instance($instance); } /** * Start your transaction before a set of dependent queries */ public function start() { $this->_db->start_transaction(); } /** * Complete your transaction on the set of queries */ public function complete() { try { static::commit(); } catch (\Exception $e) { static::rollback(); } } /** * If the group of queries had no errors, this returns TRUE * Otherwise, will return FALSE * * @return boolean */ public function status() { return true; } /** * Commit the successful queries and reset AUTOCOMMIT * This is called automatically if you use Database_Transaction::complete() * It can also be used manually for testing */ public function commit() { $this->_db->commit_transaction(); } /** * Rollback the failed queries and reset AUTOCOMMIT * This is called automatically if you use Database_Transaction::complete() * It can also be used manually for testing */ public function rollback() { $this->_db->rollback_transaction(); } /** * Return the database errors * * @return mixed (array or false) */ public function errors() { return false; } }