Best way of preventing onposterror...onediterror
Posted: Sat 07 Oct 2006 08:29
hi,
I'm new to MySql and MyDAC and used DBISAM before. Therefore i have some questions because i think i'm doing something wrong.
Within DBISAM i defined in a datamodule some constants, like
const
{Declare constants we're interested in}
DBISAM_RECLOCKFAILED =10258;
DBISAM_KEYORRECDELETED =8708;
DBISAM_INDEXCORRUPT =8965;
DBISAM_KEYVIOL =9729;
On the query.onposterror event i used this piece of code for :
procedure TdmTables.tbl_nawPostError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
begin
if (E is EDBISAMEngineError) then begin
if (EDBISAMEngineError(E).ErrorCode=DBISAM_KEYORRECDELETED) then begin
Application.MessageBox('You can't delete this record because it's in use on a other computer !'''+#10+'Record in use.', 'Warning', MB_OK+MB_ICONEXCLAMATION+MB_DEFBUTTON1+MB_APPLMODAL);
Action:=daAbort;
end;
end;
end;
Using this kind of solutions i could prevent deleting records which are
in use.
Questions :
1. is there somewhere an example of doing this in MySQL/MyDac
2. are there some errorcodes for mysql...looked...but couldn't find them
om mysql site
3. what's the best way of building a application using mysql/mydac, do you need to use transaction, commit, rollback
Greetz...and thankx
Peter
I'm new to MySql and MyDAC and used DBISAM before. Therefore i have some questions because i think i'm doing something wrong.
Within DBISAM i defined in a datamodule some constants, like
const
{Declare constants we're interested in}
DBISAM_RECLOCKFAILED =10258;
DBISAM_KEYORRECDELETED =8708;
DBISAM_INDEXCORRUPT =8965;
DBISAM_KEYVIOL =9729;
On the query.onposterror event i used this piece of code for :
procedure TdmTables.tbl_nawPostError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
begin
if (E is EDBISAMEngineError) then begin
if (EDBISAMEngineError(E).ErrorCode=DBISAM_KEYORRECDELETED) then begin
Application.MessageBox('You can't delete this record because it's in use on a other computer !'''+#10+'Record in use.', 'Warning', MB_OK+MB_ICONEXCLAMATION+MB_DEFBUTTON1+MB_APPLMODAL);
Action:=daAbort;
end;
end;
end;
Using this kind of solutions i could prevent deleting records which are
in use.
Questions :
1. is there somewhere an example of doing this in MySQL/MyDac
2. are there some errorcodes for mysql...looked...but couldn't find them
om mysql site
3. what's the best way of building a application using mysql/mydac, do you need to use transaction, commit, rollback
Greetz...and thankx
Peter