PDO Transactions

Description

Simplified DB PDO now support transactions.

Reference :
          		It can be used with insert/update/delete operation. To use this,
                first set beginTransaction=true; and then after last operation, call commitTransaction();
            

Examples

  
            <?php 
            //Example of transaction
			$sdb= new SimplifiedDB(); 
			$sdb->dbConnect("localhost", "simplified_user", "_QI4^U6~V)b[", "simplified_db");
			$sdb->beginTransaction=true;
			$sdb->dbInsert("user_roles",array("role_name"=>"role_name","role_description"=>"role_description"));//insert
			$role_id=$sdb->last_insert_id;
			$sdb->dbUpdate("users",array("role_id"=>$role_id),array("userId"=>1));//then update
			$sdb->dbDelete("user_roles",array("role_name"=>"role101","role_description"=>"role2"));//then delete
			//if any of this operation fails then it will not commit to database else it will commit to database
			$sdb->commitTransaction();                      
            ?> 
            

Result

If any of this operation fails then it will not commit to database else it will commit to database

Debuging

Debug Operation Result/Output
$sdb->query DELETE FROM user_roles WHERE `role_name`=? and `role_descsription`=?
$sdb->last_insert_id 96
$sdb->rows_affected 1
$sdb->message_info Connected to database
$sdb->error_info