When I Create A Transactions By Cdbtransaction ,it Doesn't Work

My code is:




            $r1 = $this->insert($data1);

            $r2 = $this->insert($data2);


    }catch(Exception $e){



    if($r1 && $r2){

            return true;


            return false;


my problem is ,if I have a exception in a sql,but It doesn’t rollback ,so the first sql is execute success ,other one is fail;

and another problem ,I found if I comment line $transaction->commit();the sql still can execute ,why ?

code explain:

$this->db is a instance of CDbConnection

what dbms are you using? if mysql - what storage type? if MyISAM - they do not support transactions…

thanks for your reminding ,I used mysql MyISAM . :rolleyes: thank you !