Hi
I use try .. except blocks for database app , and in except block I use rollback if anything goes wrong. How can I use Madexcept to silently create bugreport after I made rollback?
Goran
How to use MadExcept in handled exceptions?
Just one more question.
Just made my function rollbackerror() in mylibunit like :
function rollbackerror () : boolean ;
var
mybugreport : string ;
f : textfile ;
begin
mybugreport := CreateBugReport(etNormal);
AssignFile(f, 'bugreport.txt');
Append(f);
Writeln(f, mybugreport);
Flush(f); { ensures that the text was actually written to file }
CloseFile(f);
end;
and in units where I need rollback control just do this :
try
.. do something bla bla ...
DtaMod.Dbase.Commit;
except
rollbackerror() ; // my errorlogging function
DtaMod.Dbase.Rollback;
end;
Is this good way to go, or I have to look for something ?
Thanx.
Goran
Just made my function rollbackerror() in mylibunit like :
function rollbackerror () : boolean ;
var
mybugreport : string ;
f : textfile ;
begin
mybugreport := CreateBugReport(etNormal);
AssignFile(f, 'bugreport.txt');
Append(f);
Writeln(f, mybugreport);
Flush(f); { ensures that the text was actually written to file }
CloseFile(f);
end;
and in units where I need rollback control just do this :
try
.. do something bla bla ...
DtaMod.Dbase.Commit;
except
rollbackerror() ; // my errorlogging function
DtaMod.Dbase.Rollback;
end;
Is this good way to go, or I have to look for something ?
Thanx.
Goran