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 |
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 |
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); |