ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/DBAdmin/MainFormUnit.pas
Revision: 273
Committed: Mon Feb 4 13:36:50 2019 UTC (5 years, 9 months ago) by tony
Content type: text/x-pascal
File size: 38155 byte(s)
Log Message:
Fixes merged

File Contents

# Content
1 (*
2 * MainFormUnit.pas
3 * Copyright (C) 2018 Tony Whyman <tony@mwasoftware.co.uk>
4 *
5 * DBAdmin is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * DBAdmin is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 unit MainFormUnit;
19
20 {$mode objfpc}{$H+}
21
22 interface
23
24 uses
25 Classes, SysUtils, FileUtil, SynEdit, SynHighlighterSQL, SynGutterCodeFolding,
26 Forms, Controls, Graphics, Dialogs, Menus, ComCtrls, ActnList, StdCtrls,
27 DbCtrls, ExtCtrls, Buttons, db, IBLookupComboEditBox, IBDynamicGrid,
28 IBTreeView, IBDatabaseInfo, IBXServices, IBExtract, IB;
29
30 type
31
32 { TMainForm }
33
34 TMainForm = class(TForm)
35 AccessRightsPopup: TPopupMenu;
36 AccessRightsSource: TDataSource;
37 ClientLibrary: TLabel;
38 ConfigDataGrid: TIBDynamicGrid;
39 ConfigDataLabel: TLabel;
40 ConfigDataSource: TDataSource;
41 Edit12: TEdit;
42 DBDateCreated: TEdit;
43 Edit2: TEdit;
44 Edit3: TEdit;
45 Edit4: TEdit;
46 Edit5: TEdit;
47 Edit6: TEdit;
48 Edit7: TEdit;
49 Edit8: TEdit;
50 Edit9: TEdit;
51 Label44: TLabel;
52 ClientServerVersion: TMemo;
53 Label45: TLabel;
54 Label46: TLabel;
55 Label47: TLabel;
56 Label48: TLabel;
57 Label49: TLabel;
58 Label50: TLabel;
59 Label51: TLabel;
60 Label52: TLabel;
61 Label53: TLabel;
62 Label54: TLabel;
63 OpenDatabasesList: TMemo;
64 MenuItem20: TMenuItem;
65 MenuItem21: TMenuItem;
66 Panel10: TPanel;
67 RunScript: TAction;
68 AutoAdmin: TCheckBox;
69 DatabaseAliasName: TEdit;
70 DBEdit5: TDBEdit;
71 DBEdit6: TDBEdit;
72 IncludeUserGrants: TCheckBox;
73 Label41: TLabel;
74 Label42: TLabel;
75 Label43: TLabel;
76 DBComments: TMemo;
77 MenuItem19: TMenuItem;
78 RevokeAll: TAction;
79 AuthMapSource: TDataSource;
80 SubjectAccessRightsSource: TDataSource;
81 DBTablesSource: TDataSource;
82 IBDynamicGrid5: TIBDynamicGrid;
83 SubjectAccessRightsGrid: TIBDynamicGrid;
84 AccessRightsTreeView: TIBTreeView;
85 SelectAllTables: TCheckBox;
86 Label40: TLabel;
87 SelectedTablesGrid: TIBDynamicGrid;
88 Label37: TLabel;
89 Panel8: TPanel;
90 DBTablesPanel: TPanel;
91 Panel9: TPanel;
92 Phase2Repair: TAction;
93 ApplySelected: TAction;
94 AuthMethLabel: TLabel;
95 AuthMethod: TDBEdit;
96 Button7: TButton;
97 IgnoreChecksumsOnRepair: TCheckBox;
98 DBTablesSplitter: TSplitter;
99 Alltables: TRadioButton;
100 SelectedTablesOnly: TRadioButton;
101 MappingsTab: TTabSheet;
102 AccessRightsTab: TTabSheet;
103 Splitter5: TSplitter;
104 ToolButton6: TToolButton;
105 ToolButton7: TToolButton;
106 UpdateColsPanel: TPanel;
107 ValidateRepairRecordFragments: TCheckBox;
108 IgnoreChecksums: TCheckBox;
109 Label34: TLabel;
110 ReadOnlyValidation: TCheckBox;
111 RecordFragments: TCheckBox;
112 Commit2Phase: TAction;
113 DBOwner: TEdit;
114 AttmntODS12Panel: TPanel;
115 Label33: TLabel;
116 RepairOptionsTab: TTabSheet;
117 ValidateOptions: TPageControl;
118 RemoteOSLabel: TLabel;
119 RemoteOSUser: TDBEdit;
120 SecDatabase: TEdit;
121 RollbackAll: TAction;
122 CommitAll: TAction;
123 Button3: TButton;
124 Button4: TButton;
125 Button5: TButton;
126 Button6: TButton;
127 IBDynamicGrid3: TIBDynamicGrid;
128 Label38: TLabel;
129 Label39: TLabel;
130 LimboListSource: TDataSource;
131 LimboReport: TMemo;
132 RunRepair: TAction;
133 Button2: TButton;
134 SelectRepairAction: TComboBox;
135 DisconnectAttachment: TAction;
136 LimboTab: TTabSheet;
137 ValidateOptionsTab: TTabSheet;
138 MenuItem17: TMenuItem;
139 AttmtPopup: TPopupMenu;
140 MenuItem18: TMenuItem;
141 RepairTab: TTabSheet;
142 ToggleAutoRefresh: TAction;
143 AttachSource: TDataSource;
144 DBCheckBox1: TDBCheckBox;
145 DBEdit2: TDBEdit;
146 DBEdit3: TDBEdit;
147 DBEdit7: TDBEdit;
148 DeleteTag: TAction;
149 AddTag: TAction;
150 AttmtGrid: TIBDynamicGrid;
151 Label31: TLabel;
152 Label32: TLabel;
153 Label35: TLabel;
154 MenuItem11: TMenuItem;
155 MenuItem12: TMenuItem;
156 MenuItem13: TMenuItem;
157 MenuItem14: TMenuItem;
158 MenuItem15: TMenuItem;
159 MenuItem16: TMenuItem;
160 Panel7: TPanel;
161 AttDetailsPanel: TPanel;
162 UserPopup: TPopupMenu;
163 UserTagPopup: TPopupMenu;
164 SaveChanges: TAction;
165 DeleteUser: TAction;
166 ChgPassword: TAction;
167 AddUser: TAction;
168 AddFileBtn: TButton;
169 AddShadowBtn: TButton;
170 AllocatedPages: TEdit;
171 Button1: TButton;
172 DatabaseOnline: TCheckBox;
173 DBCharacterSet: TIBLookupComboEditBox;
174 DBCharSetRO: TDBEdit;
175 DBEdit4: TDBEdit;
176 DBIsReadOnly: TCheckBox;
177 DBText1: TDBText;
178 DropDatabase: TAction;
179 Edit1: TEdit;
180 Edit10: TEdit;
181 Edit11: TEdit;
182 PageBuffers: TEdit;
183 ODSVersionString: TEdit;
184 ServerVersionNo: TEdit;
185 DBSQLDialect: TEdit;
186 ConnectString: TEdit;
187 UserManagerTab: TTabSheet;
188 FilesTab: TTabSheet;
189 IBDynamicGrid1: TIBDynamicGrid;
190 IBDynamicGrid2: TIBDynamicGrid;
191 AttmtTimer: TTimer;
192 UserManagerGrid: TIBDynamicGrid;
193 RolesGrid: TIBDynamicGrid;
194 TagsGrid: TIBDynamicGrid;
195 IsShadowChk: TCheckBox;
196 Label1: TLabel;
197 Label10: TLabel;
198 Label11: TLabel;
199 Label12: TLabel;
200 Label13: TLabel;
201 Label14: TLabel;
202 Label15: TLabel;
203 Label16: TLabel;
204 Label17: TLabel;
205 Label18: TLabel;
206 Label19: TLabel;
207 Label2: TLabel;
208 Label20: TLabel;
209 Label21: TLabel;
210 Label22: TLabel;
211 DateDBCreatedLabel: TLabel;
212 Label24: TLabel;
213 Label25: TLabel;
214 Label26: TLabel;
215 Label27: TLabel;
216 Label28: TLabel;
217 Label29: TLabel;
218 Label3: TLabel;
219 Label30: TLabel;
220 Label36: TLabel;
221 Label4: TLabel;
222 Label5: TLabel;
223 Label6: TLabel;
224 Label7: TLabel;
225 Label8: TLabel;
226 Label9: TLabel;
227 LingerDelay: TEdit;
228 MenuItem10: TMenuItem;
229 MenuItem9: TMenuItem;
230 MenuItem8: TMenuItem;
231 NoReserve: TCheckBox;
232 PageControl1: TPageControl;
233 PagesAvail: TEdit;
234 PagesUsed: TEdit;
235 Panel1: TPanel;
236 Panel2: TPanel;
237 Panel3: TPanel;
238 Panel4: TPanel;
239 Panel5: TPanel;
240 RolesHeaderPanel: TPanel;
241 TagsHeader: TPanel;
242 PrimaryDBFile: TEdit;
243 Properties: TTabSheet;
244 RemoveShadowBtn: TButton;
245 RoleSource: TDataSource;
246 Save: TAction;
247 IBExtract1: TIBExtract;
248 SaveDialog: TSaveDialog;
249 SchemaTab: TTabSheet;
250 ServerLog: TMemo;
251 ServerTab: TTabSheet;
252 Splitter1: TSplitter;
253 Splitter2: TSplitter;
254 Splitter3: TSplitter;
255 Splitter4: TSplitter;
256 SQlSaveDialog: TSaveDialog;
257 RemoveShadow: TAction;
258 AddShadowSet: TAction;
259 AddSecondary: TAction;
260 MenuItem6: TMenuItem;
261 MenuItem7: TMenuItem;
262 OpenDatabase: TAction;
263 CharSetSource: TDataSource;
264 DatabaseSource: TDataSource;
265 AttmtSource: TDataSource;
266 DBCharSetSource: TDataSource;
267 IBDatabaseInfo: TIBDatabaseInfo;
268 MenuItem3: TMenuItem;
269 MenuItem4: TMenuItem;
270 MenuItem5: TMenuItem;
271 Restore: TAction;
272 Backup: TAction;
273 MenuImages: TImageList;
274 MenuItem1: TMenuItem;
275 MenuItem2: TMenuItem;
276 Quit: TAction;
277 ActionList1: TActionList;
278 MainMenu1: TMainMenu;
279 SecDBFilesSource: TDataSource;
280 ShadowSource: TDataSource;
281 StatisticsTab: TTabSheet;
282 StatsMemo: TMemo;
283 StatsOptions: TComboBox;
284 StatusBar1: TStatusBar;
285 SweepInterval: TEdit;
286 SyncWrites: TCheckBox;
287 SynEdit1: TSynEdit;
288 SynSQLSyn1: TSynSQLSyn;
289 AttachmentsTab: TTabSheet;
290 ToolBar1: TToolBar;
291 ToolButton1: TToolButton;
292 ToolButton2: TToolButton;
293 ToolButton3: TToolButton;
294 ToolButton4: TToolButton;
295 ToolButton5: TToolButton;
296 UserListSource: TDataSource;
297 UserTagsSource: TDataSource;
298 ValidationReport: TMemo;
299 procedure AccessRightsTabHide(Sender: TObject);
300 procedure AccessRightsTabShow(Sender: TObject);
301 procedure AddSecondaryExecute(Sender: TObject);
302 procedure AddShadowSetExecute(Sender: TObject);
303 procedure AddTagExecute(Sender: TObject);
304 procedure AddTagUpdate(Sender: TObject);
305 procedure AddUserExecute(Sender: TObject);
306 procedure AddUserUpdate(Sender: TObject);
307 procedure ApplySelectedExecute(Sender: TObject);
308 procedure AttachmentsTabHide(Sender: TObject);
309 procedure AttachmentsTabShow(Sender: TObject);
310 procedure AttmtTimerTimer(Sender: TObject);
311 procedure AutoAdminChange(Sender: TObject);
312 procedure BackupExecute(Sender: TObject);
313 procedure ChgPasswordExecute(Sender: TObject);
314 procedure ChgPasswordUpdate(Sender: TObject);
315 procedure Commit2PhaseExecute(Sender: TObject);
316 procedure CommitAllExecute(Sender: TObject);
317 procedure CommitAllUpdate(Sender: TObject);
318 procedure DatabaseOnlineChange(Sender: TObject);
319 procedure DBCharacterSetEditingDone(Sender: TObject);
320 procedure DBCommentsEditingDone(Sender: TObject);
321 procedure DBIsReadOnlyChange(Sender: TObject);
322 procedure DBSQLDialectEditingDone(Sender: TObject);
323 procedure DeleteTagExecute(Sender: TObject);
324 procedure DeleteTagUpdate(Sender: TObject);
325 procedure DeleteUserExecute(Sender: TObject);
326 procedure DeleteUserUpdate(Sender: TObject);
327 procedure DisconnectAttachmentExecute(Sender: TObject);
328 procedure DisconnectAttachmentUpdate(Sender: TObject);
329 procedure DropDatabaseExecute(Sender: TObject);
330 procedure DropDatabaseUpdate(Sender: TObject);
331 procedure AccessRightsTreeViewSelectionChanged(Sender: TObject);
332 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
333 procedure MappingsTabHide(Sender: TObject);
334 procedure MappingsTabShow(Sender: TObject);
335 procedure PageBuffersEditingDone(Sender: TObject);
336 procedure QuitExecute(Sender: TObject);
337 procedure RepairTabHide(Sender: TObject);
338 procedure RepairTabShow(Sender: TObject);
339 procedure RevokeAllExecute(Sender: TObject);
340 procedure RevokeAllUpdate(Sender: TObject);
341 procedure RunScriptExecute(Sender: TObject);
342 procedure SelectAllTablesChange(Sender: TObject);
343 procedure SelectedTablesOnlyChange(Sender: TObject);
344 procedure SelectRepairActionCloseUp(Sender: TObject);
345 procedure SubjectAccessRightsSourceDataChange(Sender: TObject; Field: TField
346 );
347 procedure UserManagerTabHide(Sender: TObject);
348 procedure UserManagerTabShow(Sender: TObject);
349 procedure FilesTabShow(Sender: TObject);
350 procedure FormShow(Sender: TObject);
351 procedure IsShadowChkChange(Sender: TObject);
352 procedure LimboTabHide(Sender: TObject);
353 procedure LimboTabShow(Sender: TObject);
354 procedure LingerDelayEditingDone(Sender: TObject);
355 procedure NoReserveChange(Sender: TObject);
356 procedure OpenDatabaseExecute(Sender: TObject);
357 procedure PropertiesShow(Sender: TObject);
358 procedure RemoveShadowExecute(Sender: TObject);
359 procedure RemoveShadowUpdate(Sender: TObject);
360 procedure RestoreExecute(Sender: TObject);
361 procedure RollbackAllExecute(Sender: TObject);
362 procedure RunRepairExecute(Sender: TObject);
363 procedure SaveChangesExecute(Sender: TObject);
364 procedure SaveChangesUpdate(Sender: TObject);
365 procedure SaveExecute(Sender: TObject);
366 procedure SaveUpdate(Sender: TObject);
367 procedure SchemaTabShow(Sender: TObject);
368 procedure ServerTabHide(Sender: TObject);
369 procedure ServerTabShow(Sender: TObject);
370 procedure StatisticsTabHide(Sender: TObject);
371 procedure StatisticsTabShow(Sender: TObject);
372 procedure StatsOptionsCloseUp(Sender: TObject);
373 procedure SweepIntervalEditingDone(Sender: TObject);
374 procedure SyncWritesChange(Sender: TObject);
375 procedure ToggleAutoRefreshExecute(Sender: TObject);
376 procedure ToggleAutoRefreshUpdate(Sender: TObject);
377 private
378 FLoading: boolean;
379 FLastStatsIndex: integer;
380 FServerError: boolean;
381 procedure DoDBOpen(Data: PtrInt);
382 procedure LoadServerData;
383 procedure DoExtract(Data: PtrInt);
384 procedure ConfigureOnlineValidation;
385 protected
386 procedure HandleDBConnect(Sender: TObject);
387 procedure HandleLoadData(Sender: TObject);
388 procedure ConfigureForServerVersion; virtual;
389 procedure ConnectToDatabase; virtual;
390 procedure LoadData; virtual;
391 public
392 end;
393
394 var
395 MainForm: TMainForm;
396
397 implementation
398
399 {$R *.lfm}
400
401 uses DataModule, ShutdownRegDlgUnit, AddSecondaryFileDlgUnit, NewUserDlgUnit,
402 ChgPasswordDlgUnit, FBMessages, ExecuteSQLScriptDlgUnit;
403
404 { TMainForm }
405
406 procedure TMainForm.FormShow(Sender: TObject);
407 begin
408 {Set IB Exceptions to only show text message - omit SQLCode and Engine Code}
409 DBDataModule.IBDatabase1.FirebirdAPI.GetStatus.SetIBDataBaseErrorMessages([ShowIBMessage]);
410 Application.ExceptionDialog := aedOkMessageBox;
411 PageControl1.ActivePage := Properties;
412 DBDataModule.AfterDBConnect := @HandleDBConnect;
413 DBDataModule.AfterDataReload := @HandleLoadData;
414 AccessRightsTreeView.DataSource := nil;
415 AccessRightsTreeView.DataSource := AccessRightsSource;
416 SubjectAccessRightsGrid.DataSource := nil;
417 SubjectAccessRightsGrid.DataSource := SubjectAccessRightsSource;
418 PageControl1.Visible := false;
419 Application.QueueAsyncCall(@DoDBOpen,0);
420 end;
421
422 procedure TMainForm.IsShadowChkChange(Sender: TObject);
423 begin
424 if FLoading then Exit;
425 if not DBDataModule.IsShadowDatabase then
426 begin
427 MessageDlg('A Normal Database cannot be changed into a Shadow Database',mtError,[mbOK],0);
428 FLoading := true;
429 try
430 IsShadowChk.Checked := false;
431 finally
432 FLoading := false;
433 end;
434 end
435 else
436 DBDataModule.ActivateShadow;
437 end;
438
439 procedure TMainForm.LimboTabHide(Sender: TObject);
440 begin
441 LimboListSource.DataSet.Active := false;
442 end;
443
444 procedure TMainForm.LimboTabShow(Sender: TObject);
445 begin
446 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
447 LimboListSource.DataSet.Active := true;
448 end;
449
450 procedure TMainForm.LingerDelayEditingDone(Sender: TObject);
451 begin
452 if FLoading then Exit;
453 DBDataModule.LingerDelay := LingerDelay.Text;
454 end;
455
456 procedure TMainForm.NoReserveChange(Sender: TObject);
457 begin
458 if FLoading then Exit;
459 DBDataModule.NoReserve := NoReserve.Checked;
460 end;
461
462 procedure TMainForm.DBCharacterSetEditingDone(Sender: TObject);
463 begin
464 with DBCharSetSource.Dataset do
465 if State = dsEdit then
466 Post;
467 end;
468
469 procedure TMainForm.DBCommentsEditingDone(Sender: TObject);
470 begin
471 DBDataModule.Description := DBComments.Lines.Text;
472 end;
473
474 procedure TMainForm.AutoAdminChange(Sender: TObject);
475 begin
476 if FLoading then Exit;
477 try
478 DBDataModule.AutoAdmin := AutoAdmin.Checked;
479 except on E:Exception do
480 begin
481 MessageDlg(E.message,mtError,[mbOK],0);
482 FLoading := true;
483 try
484 AutoAdmin.Checked := not AutoAdmin.Checked;
485 finally
486 FLoading := false;
487 end;
488 end;
489 end;
490 end;
491
492 procedure TMainForm.AddSecondaryExecute(Sender: TObject);
493 var FileName: string;
494 StartAt: integer;
495 FileLength: integer;
496 Pages: boolean;
497 begin
498 StartAt := 0;
499 if DBDataModule.IsDatabaseOnline then
500 begin
501 MessageDlg('The database must be shutdown before adding secondary files',
502 mtError,[mbOK],0);
503 exit;
504 end;
505
506 if AddSecondaryFileDlg.ShowModal(FileName,StartAt,FileLength,Pages) = mrOK then
507 begin
508 if not Pages then
509 begin
510 StartAt := StartAt*1024*1024 div IBDatabaseInfo.PageSize;
511 if FileLength <> -1 then
512 FileLength := FileLength*1024*1024 div IBDatabaseInfo.PageSize;
513 end;
514 DBDataModule.AddSecondaryFile(FileName,StartAt,FileLength);
515 end;
516 end;
517
518 procedure TMainForm.AccessRightsTabShow(Sender: TObject);
519 begin
520 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
521 UserListSource.DataSet.Active := true;
522 AccessRightsSource.DataSet.Active := true;
523 AccessRightsTreeViewSelectionChanged(nil);
524 end;
525
526 procedure TMainForm.AccessRightsTabHide(Sender: TObject);
527 begin
528 SubjectAccessRightsSource.DataSet.Active := false;
529 AccessRightsSource.DataSet.Active := false;
530 UserListSource.DataSet.Active := PageControl1.ActivePage = UserManagerTab;
531 end;
532
533 procedure TMainForm.AddShadowSetExecute(Sender: TObject);
534 begin
535 DBDataModule.AddShadowSet;
536 end;
537
538 procedure TMainForm.AddTagExecute(Sender: TObject);
539 begin
540 UserTagsSource.DataSet.Append;
541 end;
542
543 procedure TMainForm.AddTagUpdate(Sender: TObject);
544 begin
545 (Sender as TAction).Enabled := (UserTagsSource.State = dsBrowse);
546 end;
547
548 procedure TMainForm.AddUserExecute(Sender: TObject);
549 var NewUserName: string;
550 NewPassword: string;
551 begin
552 NewUserName := '';
553 if NewUserDlg.ShowModal(NewUserName,NewPassword) = mrOK then
554 with UserListSource.DataSet do
555 begin
556 Append;
557 FieldByName('SEC$USER_NAME').AsString := AnsiUpperCase(NewUserName);
558 FieldByName('SEC$PASSWORD').AsString := NewPassword;
559 end;
560 end;
561
562 procedure TMainForm.AddUserUpdate(Sender: TObject);
563 begin
564 (Sender as TAction).Enabled := (UserListSource.State = dsBrowse) and
565 ((DBDataModule.ServiceUserName = 'SYSDBA') or DBDataModule.HasUserAdminPrivilege);
566 end;
567
568 procedure TMainForm.ApplySelectedExecute(Sender: TObject);
569 begin
570 DBDataModule.LimboResolution(NoGlobalAction,LimboReport.Lines);
571 end;
572
573 procedure TMainForm.AttachmentsTabHide(Sender: TObject);
574 begin
575 AttachSource.DataSet.Active := false;
576 AttmtTimer.Enabled := false;
577 end;
578
579 procedure TMainForm.AttachmentsTabShow(Sender: TObject);
580 begin
581 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
582 AttachSource.DataSet.Active := true;
583 AttmtGrid.ShowEditorPanel; {assume located at current connection}
584 end;
585
586 procedure TMainForm.AttmtTimerTimer(Sender: TObject);
587 begin
588 DBDataModule.CurrentTransaction.Commit; {force a refresh}
589 end;
590
591 procedure TMainForm.BackupExecute(Sender: TObject);
592 begin
593 DBDataModule.BackupDatabase;
594 end;
595
596 procedure TMainForm.ChgPasswordExecute(Sender: TObject);
597 var NewPassword: string;
598 begin
599 NewPassword := '';
600 if ChgPasswordDlg.ShowModal(NewPassword) = mrOK then
601 with UserListSource.DataSet do
602 begin
603 Edit;
604 FieldByName('SEC$PASSWORD').AsString := NewPassword;
605 try
606 Post
607 except
608 Cancel;
609 raise;
610 end;
611 end;
612 end;
613
614 procedure TMainForm.ChgPasswordUpdate(Sender: TObject);
615 begin
616 (Sender as TAction).Enabled := UserListSource.DataSet.Active and (UserListSource.DataSet.RecordCount > 0);
617 end;
618
619 procedure TMainForm.Commit2PhaseExecute(Sender: TObject);
620 begin
621 DBDataModule.LimboResolution(RecoverTwoPhaseGlobal,LimboReport.Lines);
622 end;
623
624 procedure TMainForm.CommitAllExecute(Sender: TObject);
625 begin
626 DBDataModule.LimboResolution(CommitGlobal,LimboReport.Lines);
627 end;
628
629 procedure TMainForm.CommitAllUpdate(Sender: TObject);
630 begin
631 with LimboListSource.DataSet do
632 (Sender as TAction).Enabled := Active and (RecordCount > 0);
633 end;
634
635 procedure TMainForm.DatabaseOnlineChange(Sender: TObject);
636 var ShutDownMode: TDBShutDownMode;
637 Delay: integer;
638 begin
639 if FLoading then Exit;
640 ShutDownMode := DenyTransaction;
641 Delay := 60;
642 if DatabaseOnline.Checked then
643 DBDataModule.BringDatabaseOnline
644 else
645 if ShutdownReqDlg.ShowModal(DatabaseAliasName.Text,ShutDownMode,Delay) = mrOK then
646 DBDataModule.Shutdown(ShutdownMode,Delay);
647 end;
648
649 procedure TMainForm.DBIsReadOnlyChange(Sender: TObject);
650 begin
651 if FLoading then Exit;
652 try
653 DBDataModule.DBReadOnly := DBIsReadOnly.Checked;
654 except on E:Exception do
655 MessageDlg(E.message,mtError,[mbOK],0);
656 end;
657 end;
658
659 procedure TMainForm.DBSQLDialectEditingDone(Sender: TObject);
660 begin
661 if FLoading then Exit;
662 DBDataModule.DBSQLDialect := StrToInt(DBSQLDialect.Text);
663 end;
664
665 procedure TMainForm.DeleteTagExecute(Sender: TObject);
666 begin
667 UserTagsSource.DataSet.Delete;
668 end;
669
670 procedure TMainForm.DeleteTagUpdate(Sender: TObject);
671 begin
672 (Sender as TAction).Enabled := UserTagsSource.DataSet.Active and (UserTagsSource.DataSet.RecordCount > 0);
673 end;
674
675 procedure TMainForm.DeleteUserExecute(Sender: TObject);
676 begin
677 if MessageDlg('Do you really want to delete user ' + Trim(UserListSource.DataSet.FieldByName('SEC$USER_NAME').AsString),
678 mtConfirmation,[mbYes,mbNo],0) = mrYes then
679 UserListSource.DataSet.Delete;
680 end;
681
682 procedure TMainForm.DeleteUserUpdate(Sender: TObject);
683 begin
684 (Sender as TAction).Enabled := UserListSource.DataSet.Active and (UserListSource.DataSet.RecordCount > 0) and
685 ((DBDataModule.ServiceUserName = 'SYSDBA') or DBDataModule.HasUserAdminPrivilege);
686 end;
687
688 procedure TMainForm.DisconnectAttachmentExecute(Sender: TObject);
689 begin
690 if MessageDlg('Disconnect Attachment ID ' + AttachSource.DataSet.FieldByName('MON$ATTACHMENT_ID').AsString,
691 mtConfirmation,[mbYes,mbNo],0) = mrYes then
692 AttachSource.DataSet.Delete;
693 end;
694
695 procedure TMainForm.DisconnectAttachmentUpdate(Sender: TObject);
696 begin
697 with AttachSource.DataSet do
698 (Sender as TAction).Enabled := Active and (RecordCount > 0)
699 and (FieldByName('MON$ATTACHMENT_ID').AsInteger <>
700 AttmtSource.DataSet.FieldByName('MON$ATTACHMENT_ID').AsInteger);
701 end;
702
703 procedure TMainForm.DropDatabaseExecute(Sender: TObject);
704 begin
705 if MessageDlg(Format('Do you really want to delete the database "%s". You will lose all your data!',
706 [IBDatabaseInfo.Database.DatabaseName]),mtConfirmation,[mbYes,mbNo],0) = mrYes then
707 begin
708 DBDataModule.DropDatabase;
709 DBDataModule.Connect;
710 if not IBDatabaseInfo.Database.Connected then Close;
711 end;
712 end;
713
714 procedure TMainForm.DropDatabaseUpdate(Sender: TObject);
715 begin
716 (Sender as TAction).Enabled := IBDatabaseInfo.Database.Connected;
717 end;
718
719 procedure TMainForm.AccessRightsTreeViewSelectionChanged(Sender: TObject);
720 begin
721 if SubjectAccessRightsSource.DataSet = nil then Exit;
722 if AccessRightsSource.DataSet.Active then
723 begin
724 if (AccessRightsTreeView.Selected = nil) or (AccessRightsTreeView.Selected.Parent = nil) then
725 SubjectAccessRightsSource.DataSet.Active := false
726 else
727 DBDataModule.SyncSubjectAccessRights(TIBTreeNode(AccessRightsTreeView.Selected).KeyValue);
728 end;
729 end;
730
731 procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
732 begin
733 DBDataModule.Disconnect;
734 end;
735
736 procedure TMainForm.MappingsTabHide(Sender: TObject);
737 begin
738 AuthMapSource.DataSet.Active := false;
739 end;
740
741 procedure TMainForm.MappingsTabShow(Sender: TObject);
742 begin
743 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
744 AuthMapSource.DataSet.Active := IBDatabaseInfo.ODSMajorVersion > 11;
745 end;
746
747 procedure TMainForm.PageBuffersEditingDone(Sender: TObject);
748 begin
749 DBDataModule.PageBuffers := StrToInt(PageBuffers.Text);
750 end;
751
752 procedure TMainForm.QuitExecute(Sender: TObject);
753 begin
754 Close;
755 end;
756
757 procedure TMainForm.RepairTabHide(Sender: TObject);
758 begin
759 DBTablesSource.DataSet.Active := false;
760 end;
761
762 procedure TMainForm.RepairTabShow(Sender: TObject);
763 begin
764 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
765 SelectRepairActionCloseUp(nil);
766 ValidateOptions.ActivePage := ValidateOptionsTab;
767 end;
768
769 procedure TMainForm.RevokeAllExecute(Sender: TObject);
770 begin
771 if MessageDlg('Revoke all Access Rights from User ' + Trim(AccessRightsTreeView.Selected.Text),
772 mtConfirmation,[mbYes,mbNo],0) = mrYes then
773 DBDataModule.RevokeAll;
774 end;
775
776 procedure TMainForm.RevokeAllUpdate(Sender: TObject);
777 begin
778 with AccessRightsSource.DataSet do
779 (Sender as TAction).Enabled := Active and (RecordCount > 0) and
780 (FieldByName('SUBJECT_TYPE').AsInteger = 8);
781 end;
782
783 procedure TMainForm.RunScriptExecute(Sender: TObject);
784 begin
785 ExecuteSQLScriptDlg.ShowModal;
786 end;
787
788 procedure TMainForm.SelectAllTablesChange(Sender: TObject);
789 var aBookmark: TBookmark;
790 begin
791 with DBTablesSource.DataSet do
792 if Active then
793 begin
794 aBookmark := Bookmark;
795 DisableControls;
796 try
797 First;
798 while not EOF do
799 begin
800 Edit;
801 if SelectAllTables.Checked then
802 FieldByName('Selected').AsInteger := 1
803 else
804 FieldByName('Selected').AsInteger := 0;
805 Post;
806 Next;
807 end;
808 finally
809 Bookmark := aBookmark;
810 EnableControls;
811 end;
812 end;
813 end;
814
815 procedure TMainForm.SelectedTablesOnlyChange(Sender: TObject);
816 begin
817 SelectedTablesGrid.Enabled := SelectedTablesOnly.Checked;
818 SelectAllTables.Enabled := SelectedTablesOnly.Checked;
819 end;
820
821 procedure TMainForm.SelectRepairActionCloseUp(Sender: TObject);
822 begin
823 if (SelectRepairAction.ItemIndex = 1) and (IBDatabaseInfo.ODSMajorVersion < 12) then
824 begin
825 MessageDlg('Online validation is not support by Firebird prior to release 3',
826 mtError,[mbOK],0);
827 SelectRepairAction.ItemIndex := 2;
828 end;
829 ValidateOptions.Enabled := SelectRepairAction.ItemIndex = 2;
830 ConfigureOnlineValidation;
831 end;
832
833 procedure TMainForm.SubjectAccessRightsSourceDataChange(Sender: TObject;
834 Field: TField);
835 begin
836 if (Field = nil) and (not (Sender as TDataSource).Dataset.FieldByName('UPDATE_COLUMNS').IsNull or
837 not (Sender as TDataSource).Dataset.FieldByName('REFERENCE_COLUMNS').IsNull) then
838 SubjectAccessRightsGrid.ShowEditorPanel;
839 end;
840
841 procedure TMainForm.UserManagerTabHide(Sender: TObject);
842 begin
843 UserListSource.DataSet.Active := PageControl1.ActivePage = AccessRightsTab;
844 end;
845
846 procedure TMainForm.UserManagerTabShow(Sender: TObject);
847 begin
848 if not Visible or not IBDatabaseInfo.Database.Connected or DBDataModule.EmbeddedMode then Exit;
849 UserListSource.DataSet.Active := true;
850 end;
851
852 procedure TMainForm.FilesTabShow(Sender: TObject);
853 begin
854 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
855 PrimaryDBFile.Text := IBDatabaseInfo.DBFileName;
856 SecDBFilesSource.DataSet.Active := true;
857 ShadowSource.DataSet.Active := true;
858 end;
859
860 procedure TMainForm.OpenDatabaseExecute(Sender: TObject);
861 begin
862 PageControl1.ActivePage := Properties;
863 DBDataModule.Connect;
864 if not IBDatabaseInfo.Database.Connected then Close;
865 end;
866
867 procedure TMainForm.PropertiesShow(Sender: TObject);
868 begin
869 if Visible and (IBDatabaseInfo.Database <> nil) and IBDatabaseInfo.Database.Connected then
870 LoadData;
871 end;
872
873 procedure TMainForm.RemoveShadowExecute(Sender: TObject);
874 var ShadowSet: integer;
875 begin
876 ShadowSet := ShadowSource.DataSet.FieldByName('RDB$Shadow_Number').AsInteger;
877 DBDataModule.RemoveShadowSet(ShadowSet);
878 end;
879
880 procedure TMainForm.RemoveShadowUpdate(Sender: TObject);
881 begin
882 (Sender as TAction).Enabled := ShadowSource.DataSet.Active and (ShadowSource.DataSet.RecordCount > 0);
883 end;
884
885 procedure TMainForm.RestoreExecute(Sender: TObject);
886 begin
887 DBDataModule.RestoreDatabase;
888 end;
889
890 procedure TMainForm.RollbackAllExecute(Sender: TObject);
891 begin
892 DBDataModule.LimboResolution(RollbackGlobal,LimboReport.Lines);
893 end;
894
895 procedure TMainForm.RunRepairExecute(Sender: TObject);
896 var Options: TValidateOptions;
897 begin
898 ValidationReport.Lines.Clear;
899 case SelectRepairAction.ItemIndex of
900 0: {sweep}
901 Options := [SweepDB];
902 1: {Online Validation }
903 begin
904 DBDataModule.OnlineValidation(ValidationReport.Lines,SelectedTablesOnly.Checked);
905 Exit;
906 end;
907 2: {Full Validation}
908 if ValidateOptions.ActivePage = ValidateOptionsTab then
909 begin
910 Options := [ValidateDB];
911 if RecordFragments.Checked then
912 Options += [ValidateFull];
913 if ReadOnlyValidation.Checked then
914 Options += [CheckDB];
915 if IgnoreChecksums.Checked then
916 Options += [IgnoreChecksum];
917 end
918 else
919 begin
920 Options := [MendDB];
921 if ValidateRepairRecordFragments.Checked then
922 Options += [ValidateFull];
923 if IgnoreChecksumsOnRepair.Checked then
924 Options += [IgnoreChecksum];
925 end;
926 3: {Kill Shadows}
927 Options := [KillShadows];
928 end;
929
930 DBDataModule.DatabaseRepair(Options,ValidationReport.Lines);
931 if (SelectRepairAction.ItemIndex = 2) and (ValidateDB in Options) then
932 ValidateOptions.ActivePage := RepairOptionsTab
933 else
934 ValidateOptions.ActivePage := ValidateOptionsTab;
935 end;
936
937 procedure TMainForm.SaveChangesExecute(Sender: TObject);
938 begin
939 if UserTagsSource.DataSet.State in [dsEdit,dsInsert] then
940 UserTagsSource.DataSet.Post;
941 if RoleSource.DataSet.State in [dsEdit,dsInsert] then
942 RoleSource.DataSet.Post;
943 if UserListSource.DataSet.State in [dsEdit,dsInsert] then
944 UserListSource.DataSet.Post;
945 end;
946
947 procedure TMainForm.SaveChangesUpdate(Sender: TObject);
948 begin
949 (Sender as TAction).Enabled := (UserListSource.DataSet.State in [dsInsert,dsEdit]) or
950 (RoleSource.DataSet.State in [dsInsert,dsEdit]) or
951 (UserTagsSource.DataSet.State in [dsInsert,dsEdit]) ;
952 end;
953
954 procedure TMainForm.SaveExecute(Sender: TObject);
955 begin
956 if PageControl1.ActivePage = SchemaTab then
957 begin
958 if SQLSaveDialog.Execute then
959 SynEdit1.Lines.SaveToFile(SQLSaveDialog.FileName);
960 end
961 else
962 if PageControl1.ActivePage = StatisticsTab then
963 begin
964 if SaveDialog.Execute then
965 StatsMemo.Lines.SaveToFile(SaveDialog.FileName);
966 end;
967 end;
968
969 procedure TMainForm.SaveUpdate(Sender: TObject);
970 begin
971 (Sender as TAction).Enabled := (PageControl1.ActivePage = SchemaTab) or
972 (PageControl1.ActivePage = StatisticsTab);
973 end;
974
975 procedure TMainForm.SchemaTabShow(Sender: TObject);
976 begin
977 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
978 SynEdit1.Lines.Clear;
979 Application.QueueAsyncCall(@DoExtract,0);
980 end;
981
982 procedure TMainForm.ServerTabHide(Sender: TObject);
983 begin
984 FServerError := false;
985 end;
986
987 procedure TMainForm.ServerTabShow(Sender: TObject);
988 begin
989 if not Visible or FServerError then Exit;
990 try
991 LoadServerData;
992 DBDataModule.LoadServerLog(ServerLog.Lines);
993 except
994 FServerError := true;
995 ServerLog.Lines.Clear;
996 raise;
997 end;
998 end;
999
1000 procedure TMainForm.StatisticsTabHide(Sender: TObject);
1001 begin
1002 FLastStatsIndex := -1;
1003 end;
1004
1005 procedure TMainForm.StatisticsTabShow(Sender: TObject);
1006 begin
1007 if not Visible or not IBDatabaseInfo.Database.Connected then Exit;
1008 if FLastStatsIndex <> StatsOptions.ItemIndex then {avoids loops if exception raise in load stats}
1009 StatsOptionsCloseUp(nil);
1010 end;
1011
1012 procedure TMainForm.StatsOptionsCloseUp(Sender: TObject);
1013 begin
1014 StatsMemo.Lines.Clear;
1015 FLastStatsIndex := StatsOptions.ItemIndex;
1016 DBDataModule.LoadDatabaseStatistics(StatsOptions.ItemIndex,StatsMemo.Lines);
1017 end;
1018
1019 procedure TMainForm.SweepIntervalEditingDone(Sender: TObject);
1020 begin
1021 if FLoading then Exit;
1022 DBDataModule.SweepInterval := StrtoInt(SweepInterval.Text);
1023 end;
1024
1025 procedure TMainForm.SyncWritesChange(Sender: TObject);
1026 begin
1027 if FLoading then Exit;
1028 DBDataModule.ForcedWrites := SyncWrites.Checked;
1029 end;
1030
1031 procedure TMainForm.ToggleAutoRefreshExecute(Sender: TObject);
1032 begin
1033 AttmtTimer.Enabled := not AttmtTimer.Enabled;
1034 end;
1035
1036 procedure TMainForm.ToggleAutoRefreshUpdate(Sender: TObject);
1037 begin
1038 (Sender as TAction).Enabled := AttachSource.DataSet.Active;
1039 (Sender as TAction).Checked := AttmtTimer.Enabled;
1040 end;
1041
1042 procedure TMainForm.DoDBOpen(Data: PtrInt);
1043 begin
1044 ConnectToDatabase;
1045 end;
1046
1047 procedure TMainForm.HandleDBConnect(Sender: TObject);
1048 begin
1049 ConfigureForServerVersion;
1050 PageControl1.ActivePage := Properties;
1051 ValidationReport.Lines.Clear;
1052 LimboReport.Lines.Clear;
1053 FLastStatsIndex := -1;
1054 end;
1055
1056 procedure TMainForm.HandleLoadData(Sender: TObject);
1057 begin
1058 if DBDataModule.EmbeddedMode then
1059 StatusBar1.SimpleText := Format('Database: %s - Logged in as user %s in embedded mode',
1060 [DBDataModule.IBDatabase1.DatabaseName,DBDataModule.IBDatabase1.Params.Values['user_name']
1061 ])
1062 else
1063 if DBDataModule.DBUserName = 'SYSDBA' then
1064 StatusBar1.SimpleText := Format('Database: %s - Logged in as user %s by %s, using %s security database.',
1065 [DBDataModule.IBDatabase1.DatabaseName,DBDataModule.DBUserName,
1066 DBDataModule.AuthMethod, DBDataModule.SecurityDatabase])
1067 else
1068 StatusBar1.SimpleText := Format('Database: %s - Logged in as user %s by %s, using %s security database. Role = %s',
1069 [DBDataModule.IBDatabase1.DatabaseName,DBDataModule.DBUserName,
1070 DBDataModule.AuthMethod, DBDataModule.SecurityDatabase,DBDataModule.RoleName]);
1071 if assigned(PageControl1.ActivePage.OnShow) then
1072 PageControl1.ActivePage.OnShow(nil);
1073 ClientLibrary.Caption := 'Firebird Client Library: ' + DBDataModule.IBDatabase1.FirebirdAPI.GetFBLibrary.GetLibraryFilePath +
1074 ' (API Version = ' + DBDataModule.IBDatabase1.FirebirdAPI.GetImplementationVersion + ')';
1075 end;
1076
1077 procedure TMainForm.LoadData;
1078 begin
1079 if FLoading then Exit;
1080 FLoading := true;
1081 try
1082 DatabaseAliasName.Text := DBDataModule.DatabaseName;
1083 Edit1.Text := IBDatabaseInfo.DBSiteName;
1084 ODSVersionString.Text := Format('%d.%d',[IBDatabaseInfo.ODSMajorVersion,IBDatabaseInfo.ODSMinorVersion]);
1085 ServerVersionNo.Text := IBDatabaseInfo.Version;
1086 DBSQLDialect.Text := IntToStr(DBDataModule.DBSQLDialect);
1087 ConnectString.Text := DBDataModule.IBDatabase1.DatabaseName;
1088 DBDateCreated.Text := DBDataModule.DBDateCreated;
1089 Edit10.Text := IntToStr(IBDatabaseInfo.CurrentMemory);
1090 Edit11.Text := IntToStr(IBDatabaseInfo.MaxMemory);
1091 PageBuffers.Text := IntToStr(DBDataModule.PageBuffers);
1092 AllocatedPages.Text := IntToStr(IBDatabaseInfo.Allocation);
1093 DBIsReadOnly.Checked := DBDataModule.DBReadOnly;
1094 SyncWrites.Checked := DBDataModule.ForcedWrites;
1095 SweepInterval.Text := IntToStr(IBDatabaseInfo.SweepInterval);
1096 NoReserve.Checked := DBDataModule.NoReserve;
1097 LingerDelay.Text := DBDataModule.LingerDelay;
1098 SecDatabase.Text := DBDataModule.SecurityDatabase;
1099 DBOwner.Text := DBDataModule.DBOwner;
1100 DatabaseOnline.Checked := DBDataModule.IsDatabaseOnline;
1101 IsShadowChk.Checked := DBDataModule.IsShadowDatabase;
1102 if IBDatabaseInfo.ODSMajorVersion >= 12 then
1103 begin
1104 PagesUsed.Text := IntToStr(IBDatabaseInfo.PagesUsed);
1105 PagesAvail.Text := IntToStr(IBDatabaseInfo.PagesFree);
1106 AutoAdmin.Checked := not DBDataModule.EmbeddedMode and DBDataModule.AutoAdmin;
1107 end
1108 else
1109 begin
1110 PagesUsed.Text := 'n/a';
1111 PagesAvail.Text := 'n/a';
1112 AutoAdmin.Checked := false;
1113 end;
1114 DBDataModule.IBDatabase1.Attachment.getFBVersion(ClientServerVersion.Lines);
1115 DBComments.Lines.Text := DBDataModule.Description;
1116 finally
1117 FLoading := false;
1118 end;
1119 end;
1120
1121 procedure TMainForm.LoadServerData;
1122 var i: integer;
1123 begin
1124 with DBDataModule.IBServerProperties1 do
1125 begin
1126 Edit3.Text := VersionInfo.ServerVersion;
1127 Edit2.Text := IntToStr(VersionInfo.ServiceVersion);
1128 Edit4.Text := VersionInfo.ServerImplementation;
1129 OpenDatabasesList.Clear;
1130 for i := 0 to DatabaseInfo.NoOfDatabases - 1 do
1131 OpenDatabasesList.Lines.Add(DatabaseInfo.DbName[i]);
1132 ConfigDataGrid.Visible := DBDataModule.LoadConfigData(ConfigParams.ConfigFileData);
1133 ConfigDataLabel.Visible := ConfigDataGrid.Visible;
1134 if ConfigDataGrid.Visible then
1135 begin
1136 OpenDatabasesList.Height := ConfigDataLabel.Top - OpenDatabasesList.Top - 6;
1137 OpenDatabasesList.Anchors := OpenDatabasesList.Anchors - [akBottom];
1138 end
1139 else
1140 begin
1141 OpenDatabasesList.Height := ConfigDataGrid.Top - OpenDatabasesList.Top + ConfigDataGrid.Height;
1142 OpenDatabasesList.Anchors := OpenDatabasesList.Anchors + [akBottom];
1143 end;
1144 Edit5.Text := ConfigParams.BaseLocation;
1145 Edit6.Text := ConfigParams.LockFileLocation;
1146 Edit7.Text := ConfigParams.SecurityDatabaseLocation;
1147 Edit9.Text := ConfigParams.MessageFileLocation;
1148 Edit8.Text := ServicesConnection.ServerName;
1149 Edit12.Text := IntToStr(DatabaseInfo.NoOfAttachments);
1150 end;
1151 end;
1152
1153 procedure TMainForm.DoExtract(Data: PtrInt);
1154 begin
1155 Screen.Cursor := crHourGlass;
1156 try
1157 Application.ProcessMessages;
1158 if IncludeUserGrants.Checked then
1159 IBExtract1.ExtractObject(eoDatabase,'',[etGrantsToUser])
1160 else
1161 IBExtract1.ExtractObject(eoDatabase);
1162 SynEdit1.Lines.Assign(IBExtract1.Items);
1163 finally
1164 Screen.Cursor := crDefault;
1165 end;
1166 end;
1167
1168 procedure TMainForm.ConfigureForServerVersion;
1169 var i: integer;
1170 begin
1171 if (IBDatabaseInfo.ODSMajorVersion >= 12) and
1172 ((DBDataModule.ServiceUserName = 'SYSDBA') or (DBDataModule.RoleName = 'RDB$ADMIN') or
1173 not DBDataModule.HasUserAdminPrivilege) then
1174 begin
1175 for i in [9,10] do
1176 UserManagerGrid.Columns[i].Visible := false;
1177 for i in [4,6,7,8] do
1178 UserManagerGrid.Columns[i].Visible := true ;
1179 UserListSource.DataSet := DBDataModule.UserList;
1180 TagsHeader.Visible := true;
1181 TagsGrid.Visible := true;
1182 end
1183 else
1184 begin
1185 for i in [4,6,7,8] do
1186 UserManagerGrid.Columns[i].Visible := false;
1187 for i in [9,10] do
1188 UserManagerGrid.Columns[i].Visible := true;
1189 UserListSource.DataSet := DBDataModule.LegacyUserList;
1190 TagsHeader.Visible := false;
1191 TagsGrid.Visible := false;
1192 end;
1193
1194 if IBDatabaseInfo.ODSMajorVersion >= 12 then
1195 begin
1196 AttmtGrid.Columns[2].Visible := true;
1197 AttmntODS12Panel.Visible := true;
1198 DBCharacterSet.Visible := true;
1199 DBCharSetRO.Visible := false;
1200 end
1201 else
1202 begin
1203 AttmtGrid.Columns[2].Visible := false;
1204 AttmntODS12Panel.Visible := false;
1205 DBCharacterSet.Visible := false;
1206 DBCharSetRO.Visible := true;
1207 end;
1208 MappingsTab.TabVisible := not DBDataModule.EmbeddedMode and
1209 ((IBDatabaseInfo.ODSMajorVersion > 11) or
1210 ((IBDatabaseInfo.ODSMajorVersion = 11) and (IBDatabaseInfo.ODSMinorVersion > 0)));
1211 UserManagerTab.TabVisible := not DBDataModule.EmbeddedMode;
1212 AccessRightsTab.TabVisible := not DBDataModule.EmbeddedMode;
1213 AutoAdmin.Enabled := not DBDataModule.EmbeddedMode;
1214 end;
1215
1216 procedure TMainForm.ConnectToDatabase;
1217 begin
1218 if not DBDataModule.Connect then Close;
1219 PageControl1.Visible := true;
1220 end;
1221
1222 procedure TMainForm.ConfigureOnlineValidation;
1223 begin
1224 if SelectRepairAction.ItemIndex = 1 then
1225 begin
1226 DBTablesPanel.Visible := true;
1227 DBTablesSplitter.Visible := true;
1228 SelectedTablesGrid.Enabled := SelectedTablesOnly.Checked;
1229 SelectAllTables.Checked := true;
1230 DBTablesSource.DataSet.Active := true;
1231 end
1232 else
1233 begin
1234 DBTablesPanel.Visible := false;
1235 DBTablesSplitter.Visible := false;
1236 SelectAllTables.Enabled := false;
1237 DBTablesSource.DataSet.Active := false;
1238 end;
1239 end;
1240
1241 end.
1242