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

Comparing ibx/trunk/examples/local-employeedb/unit1.pas (file contents):
Revision 271 by tony, Thu Dec 6 15:55:01 2018 UTC vs.
Revision 272 by tony, Mon Feb 4 13:34:37 2019 UTC

# Line 189 | Line 189 | type
189      { private declarations }
190      FDirty: boolean;
191      FNoAutoReopen: boolean;
192 +    procedure DoDBOpen(Data: PtrInt);
193      procedure Reopen(Data: PtrInt);
194      function GetDBVersionNo: integer;
195    public
# Line 240 | Line 241 | begin
241    (Sender as TAction).Enabled := FDirty
242   end;
243  
244 + procedure TForm1.DoDBOpen(Data: PtrInt);
245 + begin
246 +  try
247 +    IBDatabase1.Connected := true;
248 +  except On E:Exception do
249 +    begin
250 +     MessageDlg(E.Message,mtError,[mbOK],0);
251 +     Close;
252 +     Exit
253 +    end;
254 +  end;
255 +
256 +  {If upgrade failed or downgrade not pending then exit}
257 +  with IBLocalDBSupport1 do
258 +    if (CurrentDBVersionNo < RequiredVersionNo) or
259 +       ((CurrentDBVersionNo >  RequiredVersionNo) and not DowngradePending) then
260 +    Close;
261 + end;
262 +
263   procedure TForm1.Reopen(Data: PtrInt);
264   begin
265    with IBTransaction1 do
# Line 515 | Line 535 | begin
535    {Set IB Exceptions to only show text message - omit SQLCode and Engine Code}
536    IBDatabase1.FirebirdAPI.GetStatus.SetIBDataBaseErrorMessages([ShowIBMessage]);
537    Application.ExceptionDialog := aedOkMessageBox;
538 <  try
519 <    IBDatabase1.Connected := true;
520 <  except On E:Exception do
521 <    begin
522 <     MessageDlg(E.Message,mtError,[mbOK],0);
523 <     Close;
524 <     Exit
525 <    end;
526 <  end;
527 <
528 <  {If upgrade failed or downgrade not pending then exit}
529 <  with IBLocalDBSupport1 do
530 <    if (CurrentDBVersionNo < RequiredVersionNo) or
531 <       ((CurrentDBVersionNo >  RequiredVersionNo) and not DowngradePending) then
532 <    Close;
538 >  Application.QueueAsyncCall(@DoDBOpen,0);
539   end;
540  
541   procedure TForm1.EmployeesAfterDelete(DataSet: TDataSet);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines