title: Total rollback on nested transactions
body: <p>I really like this <strong><a href="http://www.yiiframework.com/wiki/38/how-to-use-nested-db-transactions-mysql-5-postgresql/" rel="nofollow">NestedPDO</a></strong> solution for Yii but I need some different transaction handling. </p>
  
  <p>I want to commit my nested transactions only if all nested transactions could be commited and if ONE transaction does a rollback all transactions should be rolled back. </p>
  
  <p>How can I do that?</p>
  
  <p>My try of changing the rollBack function which didn't work:</p>
  
  <pre><code>public function rollBack() {
      $this-&gt;transLevel--;
  
      if($this-&gt;transLevel == 0 || !$this-&gt;nestable()) {
          parent::rollBack();
      } else {
  
          $level = $this-&gt;transLevel;
          for($level; $level&gt;1; $level--){
              $this-&gt;exec("ROLLBACK TO SAVEPOINT LEVEL{$this-&gt;constantlevel}");
          }
          //parent::rollBack();
      }
  }
  </code></pre>
  
  <p>I was thinking of adapting the NestedPDO: In function commit() do a commit only on the outermost transaction and in function rollBack() do a rollback to the outermost transaction no matter which sub transaction caused the rollback. But I could not get it done...</p>
  
  <p>I'm using MySQL and InnoDB tables and I'm not sure about autocommit but when echoing the value of autocommit within a transaction I always get the value 1 which should mean autocommit is on but within a transaction autocommit should be set to 0. I'm not sure whether this is the cause why a whole rollback does not work for me?</p>