public function rollback() { if ($this->state == self::DB_TRANSACTION_STARTED) { if (B2DB::getDBLink()->rollback()) { $this->state = self::DB_TRANSACTION_ROLLEDBACK; B2DB::setTransaction(false); } else { throw new B2DBException('Error rolling back transaction: ' . B2DB::getDBLink()->error); } } else { throw new B2DBException('There is no active transaction'); } }