Welcome Guest, Not a member yet? Register   Sign In
maybe transaction bug !
#1

[eluser]Nima A.[/eluser]
well, I'm not sure about it, but let's try , ...
consider a situation which you have 3 queries in a transaction (apperently in a model), as described below :


Code:
....
$this->db->trans_start();

//query1 : right query
$query1 = "update ....";
$lnk1 = $this->db->query($query1);

//query2 : wrong query , cause error , the operation will stop here
$query2 = "update ....";
$lnk2 = $this->db->query($query2);


//query3 : right query - never executes in this situation
$query3 = "update ....";
$lnk3 = $this->db->query($query3);


$this->db->trans_complete();

in this situation, everything is fine ! first, query1 executes successfully and the result affects database fields, but query2 generates sql error and thus, roll back operation starts automatically for query1 and finally query1 does not affect DataBase (this is correct and that's what we expect)

everything is fine till now, but from now on ...

>> delete the contents of query1 and query2 to let your model method contain just query3 , I mean this :

Code:
$this->db->trans_start();
//query3 : right query
$query3 = "update ....";
$lnk3 = $this->db->query($query3);


$this->db->trans_complete();

and then refresh the previous page that described the error
in this case we expect to see the result of query3 (just query3 !) but unfortunately previous query1 also affect the database !!!

why ?


Messages In This Thread
maybe transaction bug ! - by El Forum - 07-02-2008, 11:39 PM
maybe transaction bug ! - by El Forum - 07-05-2008, 11:33 PM
maybe transaction bug ! - by El Forum - 07-08-2008, 03:42 AM
maybe transaction bug ! - by El Forum - 07-08-2008, 04:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB