On Thursday 29 September 2011 10.28:34 wahono sri wrote:
> > Restoring updates after rollback is internal to tmsebufdataset and does
> > not involve the server so I think the problem is more likely a savepoint
> > or transaction problem. I don't know how MySQL handles savepoints and
> > transactions. I read that MySQL transaction handling is not well
> > designed. You probably need to do some investigations.
> > 
> > I don't found what SQL syntax send from tmsemysqlconnection to MySQL
> > server
> 
> to activate savepoint  feature.
> What's the syntax?

It is in lib/common/db/msqldb.pas
"
function TSQLTransaction.savepointbegin: integer;
var
 mstr1: msestring;
begin
 active:= true;
 inc(fsavepointlevel);
 result:= fsavepointlevel;
 mstr1:= 'sp'+inttostrmse(result);
 database.executedirect('SAVEPOINT '+mstr1+';',self,nil,false,true);
 savepointevent(spek_begin,result);
end;

procedure tsqltransaction.checkpendingaction;
var
 act1: tcommitrollbackaction;
 bo1: boolean;
begin
 if (fpendingaction <> canone) and (fsavepointlevel < 0) and active then begin
  act1:= fpendingaction;
  bo1:= fpendingrefresh;
  fpendingaction:= canone;
  fpendingrefresh:= false;
  if bo1 then begin
   refresh(act1);
  end
  else begin
   doendtransaction(act1);
  end;
 end;
end;

procedure TSQLTransaction.savepointrollback(alevel: integer = -1);
begin
 checkactive;
 if alevel = -1 then begin
  alevel:= fsavepointlevel;
 end;
 if alevel >= 0 then begin
  database.executedirect('ROLLBACK TO '+'sp'+inttostrmse(alevel)+';',
                                                     self,nil,false,true); 
  fsavepointlevel:= alevel-1;
  savepointevent(spek_rollback,alevel);
  checkpendingaction;
 end;
end;

procedure TSQLTransaction.savepointrelease;
begin
 checkactive;
 if fsavepointlevel >= 0 then begin
  database.executedirect('RELEASE SAVEPOINT '+'sp'+
             inttostrmse(fsavepointlevel)+';',self,nil,false,true); 
  dec(fsavepointlevel);
  savepointevent(spek_release,fsavepointlevel+1);
  checkpendingaction;
 end;
end;

"
_______________________________________________
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk

Reply via email to