Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 7 of 7 total |
Strange kind of error report (not EDBISAMEngineError?) |
Sun, Jan 22 2006 10:58 AM | Permanent Link |
Joze | Hi,
I am new at Dbisam (still learning) so please be kind with me I have few required fields in my table. When I delete such field's value an try to post changes an error is reported. This was expected. I am using code from manuals: procedure TForm1.DBISAMTable1PostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin Action := daAbort; if (E is EDBISAMEngineError) then begin if (EDBISAMEngineError(E).ErrorCode = DBISAM_KEYVIOL) then MessageDlg('A record with the same key value(s) already exists, ' + 'please change the record to make the value(s) unique ' + 'and re-post the record', mtError, [mbOK], 0) else if (EDBISAMEngineError(E).ErrorCode = DBISAM_REQDERR) then MessageDlg('The ' + EDBISAMEngineError(E).ErrorFieldName + ' field is required, ' + 'please change the record to provide a value for this field ' + 'and re-post the record', mtError, [mbOK], 0) else if (EDBISAMEngineError(E).ErrorCode = DBISAM_MINVALERR) or (EDBISAMEngineError(E).ErrorCode = DBISAM_MAXVALERR) then MessageDlg('The value provided for the ' + EDBISAMEngineError(E).ErrorFieldName + ' field is invalid, ' + 'please change the record to provide a proper value for this field ' + 'and re-post the record', mtError, [mbOK], 0) else if (EDBISAMEngineError(E).ErrorCode = DBISAM_LOCKED) then begin if MessageDlg('The table you are trying to add is currently locked, ' + 'do you want to try to post this record again?', mtWarning, [mbYes, mbNo], 0) = mrYes then Action := daRetry; end else MessageDlg(E.Message, mtError, [mbOK], 0); end else MessageDlg(E.Message, mtError, [mbOK], 0); end; I was expecting error would be reported as DBISAM_REQDERR but it isn't. Error is reported in last line of PostError procedure - so the error isn't an EDBISAMEngineError !? I was expecting it should be an EDBISAMEngineError. if (E is EDBISAMEngineError) then .... else Error is reported here !!! How is this possible? Can someone explain this please. Dbisam 4.22 build 1 Delphi 7 Win XP TIA for any explanation. Regards, Joze P.S. I have a small demo if someone want to see it |
Sun, Jan 22 2006 11:16 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Joze
As a guess the error is being raised BEFORE DBISAM does its checks. What you have to remember is that DBISAM is built on top of Delphi and uses much of it (eg TFields) so for example if you define a persistent field using the fields editor in the IDE and set required there rather than in the table definition Delphi will object to the fact that its null not DBISAM. Roy Lambert |
Sun, Jan 22 2006 11:22 AM | Permanent Link |
Joze | Additional notes:
for other type od errors like: if (EDBISAMEngineError(E).ErrorCode = DBISAM_KEYVIOL) else if (EDBISAMEngineError(E).ErrorCode = DBISAM_MINVALERR) or (EDBISAMEngineError(E).ErrorCode = DBISAM_MAXVALERR) then it works OK. Regards, Joze |
Sun, Jan 22 2006 11:40 AM | Permanent Link |
Joze | Hi Roy,
Thanks for your help. Yes, I defined fields using the fields editor in the IDE. If I set required property to false in IDE Dbisam is reporting DBISAM_REQDERR error. If I delete all defined fields in IDE, Delphi (and not Dbisam) is reporting this error again. My test shows: - without defining fields in IDE error is reported by Delphi. - if I define fields in IDE and I leave required property to true, error is reported by Delphi - if I define fields in IDE and I set required property to false, error is reported by Dbisam So my question is: should I allways clear required propety in IDE to prevent error report from Delphi (and leave it to Dbisam)? Regards, Joze On Sun, 22 Jan 2006 16:16:43 +0000, Roy Lambert <roy.lambert@skynet.co.uk> wrote: >Joze > > >As a guess the error is being raised BEFORE DBISAM does its checks. What you have to remember is that DBISAM is built on top of Delphi and uses much of it (eg TFields) so for example if you define a persistent field using the fields editor in the IDE and set required there rather than in the table definition Delphi will object to the fact that its null not DBISAM. > >Roy Lambert |
Sun, Jan 22 2006 12:55 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Joze
My approach would be either to enforce in code yourself (probably in the BeforePost or fields OnValidate events) or define the constraints at the table level when creating the table (or alter using DBSys). Using either of those approaches you don't have to worry about inconsistencies in how Delphi / whatever database works. Roy Lambert |
Sun, Jan 22 2006 3:08 PM | Permanent Link |
Joze | Roy,
I create my table with DbSys and option required is set (only) there. If I don't define any fields in IDE required error is still reported by Delphi and not by Dbisam. So the only way I've found (with your tip) to prevent this is to define fields in IDE using fields editor and then manually set all fields required property to false (using IDE fields editor). Only this way required error is than reported by Dbisam and not by Delphi. Is this the only way or am I doing something wrong? Regards, Joze |
Mon, Jan 23 2006 5:26 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Joze,
<< So my question is: should I allways clear required propety in IDE to prevent error report from Delphi (and leave it to Dbisam)? >> Yes, that is the correct way to force the required checks to be handled by DBISAM. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, April 17, 2024 at 10:35 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |