ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/employee/unit1.pas
(Generate patch)

Comparing ibx/trunk/examples/employee/unit1.pas (file contents):
Revision 208 by tony, Fri Feb 23 12:11:21 2018 UTC vs.
Revision 209 by tony, Wed Mar 14 12:48:51 2018 UTC

# Line 171 | Line 171 | implementation
171  
172   {$R *.lfm}
173  
174 < uses IB, Unit2;
174 > uses IB, Unit2, FBMessages;
175  
176   const
177    sNoName = '<no name>';
178  
179 function ExtractDBException(msg: string): string;
180 var Lines: TStringList;
181 begin
182     Lines := TStringList.Create;
183     try
184       Lines.Text := msg;
185       if pos('exception',Lines[0]) = 1 then
186         Result := Lines[2]
187       else
188         Result := msg
189     finally
190       Lines.Free
191     end;
192 end;
193
179   { TForm1 }
180  
181   procedure TForm1.EmployeesSALARYGetText(Sender: TField; var aText: string;
# Line 228 | Line 213 | begin
213    with IBTransaction1 do
214      if not InTransaction then StartTransaction;
215    Countries.Active := true;
216 +  Employees.EnableStatistics := true;
217    Employees.Active := true;
218    JobCodes.Active := true;
219    Depts.Active := true;
# Line 354 | Line 340 | begin
340    if AfterDate.Date > 0 then
341       (DataSet as TIBParserDataSet).Parser.Add2WhereClause('HIRE_DATE > :AfterDate');
342  
343 +
344    case SalaryRange.ItemIndex of
345    1:
346      (DataSet as TIBParserDataSet).Parser.Add2WhereClause('Salary < 40000');
# Line 392 | Line 379 | end;
379  
380   procedure TForm1.FormShow(Sender: TObject);
381   begin
382 +  {Set IB Exceptions to only show text message - omit SQLCode and Engine Code}
383 +  FirebirdAPI.GetStatus.SetIBDataBaseErrorMessages([ShowIBMessage]);
384 +  Application.ExceptionDialog := aedOkMessageBox;
385    repeat
386      try
387        IBDatabase1.Connected := true;
# Line 425 | Line 415 | procedure TForm1.EmployeesPostError(Data
415   begin
416    if E is EIBError then
417     begin
418 <       MessageDlg(ExtractDBException(EIBError(E).message),mtError,[mbOK],0);
418 >       MessageDlg(EIBError(E).message,mtError,[mbOK],0);
419         DataSet.Cancel;
420         DataAction  := daAbort
421     end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines