ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/design/IBDBReg.pas
(Generate patch)

Comparing ibx/trunk/design/IBDBReg.pas (file contents):
Revision 80 by tony, Mon Jan 1 11:31:07 2018 UTC vs.
Revision 315 by tony, Thu Feb 25 11:56:36 2021 UTC

# Line 27 | Line 27
27   {    IBX For Lazarus (Firebird Express)                                  }
28   {    Contributor: Tony Whyman, MWA Software http://www.mwasoftware.co.uk }
29   {    Portions created by MWA Software are copyright McCallum Whyman      }
30 < {    Associates Ltd 2011                                                 }
30 > {    Associates Ltd 2011 - 2018                                               }
31   {************************************************************************}
32  
33   unit IBDBReg;
# Line 63 | Line 63 | type
63    Property editor the DataBase Name property.  Brings up the Open dialog }
64  
65    TIBFileNameProperty = class(TStringProperty)
66 +  protected
67 +    function GetFilter: string; virtual;
68    public
69      procedure Edit; override;
70      function GetAttributes: TPropertyAttributes; override;
71    end;
72  
73 +  { TIBLibraryNameProperty }
74 +
75 +  TIBLibraryNameProperty = class(TIBFileNameProperty)
76 +  protected
77 +    function GetFilter: string; override;
78 +  end;
79 +
80    { TIBNameProperty
81    }
82    TIBNameProperty = class(TStringProperty)
# Line 83 | Line 92 | type
92      procedure GetValues(Proc: TGetStrProc); override;
93    end;
94  
95 +  { TIBPackageNameProperty
96 +    Editor for the TIBStoredProc.PackageName property.  Displays a drop-down list of all
97 +    the StoredProcedures in the Database.}
98 +  TIBPackageNameProperty = class(TIBNameProperty)
99 +  public
100 +    procedure GetValues(Proc: TGetStrProc); override;
101 +  end;
102 +
103    { TIBTableNameProperty
104      Editor for the TIBTable.TableName property.  Displays a drop-down list of all
105      the Tables in the Database.}
# Line 195 | Line 212 | type
212     function GetVerbCount: Integer; override;
213    end;
214  
215 <  TIBStoredProcParamsProperty = class(TCollectionPropertyEditor)
215 >  { TIBXServiceEditor }
216 >
217 >  TIBXServiceEditor = class(TComponentEditor)
218    public
219 <    procedure Edit; override;
219 >    procedure ExecuteVerb(Index: Integer); override;
220 >    function GetVerb(Index: Integer): string; override;
221 >    function GetVerbCount: Integer; override;
222 >  end;
223 >
224 >  TIBStoredProcParamsProperty = class(TCollectionPropertyEditor)
225    end;
226  
227    { TIBTableFieldLinkProperty }
# Line 316 | Line 340 | type
340      procedure Edit; override;
341    end;
342  
343 +  { TIBUpdateRefreshSQLProperty }
344 +
345 +  TIBUpdateRefreshSQLProperty = class(TSQLPropertyEditor)
346 +  protected
347 +    FIBUpdate: TIBUpdate;
348 +    FDatabase: TIBDatabase;
349 +    function GetObjects: boolean;
350 +  public
351 +    procedure Edit; override;
352 +  end;
353 +
354 +
355   { TIBEventListProperty }
356  
357    TIBEventListProperty = class(TClassProperty)
# Line 381 | Line 417 | procedure Register;
417  
418   implementation
419  
420 < uses IB, IBQuery, IBStoredProc, IBCustomDataSet, FBMessages,
421 <     IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, IBTypes,
422 <     IBServices, IBDatabaseEdit, IBTransactionEdit,
420 > uses IB, IBQuery, IBStoredProc, IBCustomDataSet, IBMessages,
421 >     IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, IBInternals,
422 >     IBServices, IBXServices, IBDatabaseEdit, IBTransactionEdit,
423       IBBatchMove, IBExtract,LResources, IBSelectSQLEditor,
424       IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor,
425       IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor,
426       IBSQLEditor, ibserviceeditor, LCLVersion, IBDynamicGrid, IBLookupComboEditBox,
427       IBTreeView, DBControlGrid, ibxscript, IBLocalDBSupport, IBDSDialogs,
428 <     IBArrayGrid, IBVersion, IBDataOutput;
428 >     IBArrayGrid, IBVersion, IBDataOutput, IBXServiceEditor;
429  
430   const
431    IBPalette1 = 'Firebird'; {do not localize}
432 <  IBPalette2 = 'Firebird Admin'; {do not localize}
432 >  IBPalette2 = 'Firebird Legacy Admin'; {do not localize}
433    IBPalette3 = 'Firebird Data Controls';   {do not localize}
434 <  
434 >  IBPalette4 = 'Firebird Admin'; {do not localize}
435 >
436   resourcestring
437     SInterbaseExpressVersion = 'Firebird Express for Lazarus ' + IBX_VERSION;
438     SEditSQL = 'Edit SQL';
# Line 410 | Line 447 | const
447  
448   procedure Register;
449   begin
450 +  AllowUseOfFBLIB := true;
451    if not TryIBLoad then
452    begin
453      MessageDlg('IBX is unable to locate the Firebird Library - have you remembered to install it?',mtError,[mbOK],0);
454      Exit;
455    end;
456  
457 <  RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField]);
457 >  RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField,
458 >    TIBSmallintField, TIBIntegerField, TIBLargeIntField, TIBDateTimeField,
459 >    TIBTimeField]);
460    {$if lcl_fullversion < 01010000}
461    {see http://bugs.freepascal.org/view.php?id=19035 }
462    RegisterNoIcon([TIntegerField]);
# Line 427 | Line 467 | begin
467         TIBStoredProc,TIBBatchMove,  TIBTable,TIBExtract, TIBXScript, TIBLocalDBSupport,
468         TIBBlockFormatOut,TIBCSVDataOut,TIBInsertStmtsOut]);
469    if FirebirdAPI.HasServiceAPI  then
470 +  begin
471 +    RegisterComponents(IBPalette4, [TIBXServicesConnection, TIBXConfigService,
472 +      TIBXClientSideBackupService, TIBXServerSideBackupService,
473 +      TIBXClientSideRestoreService, TIBXServerSideRestoreService,
474 +      TIBXValidationService, TIBXOnlineValidationService, TIBXStatisticalService,
475 +      TIBXLogService, TIBXSecurityService, TIBXServerProperties,
476 +      TIBXLimboTransactionResolutionService,TIBXServicesUserList, TIBXServicesLimboTransactionsList]);
477      RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService,
478 <      TIBRestoreService, TIBValidationService, TIBStatisticalService,
478 >      TIBRestoreService, TIBValidationService,
479 >      TIBOnlineValidationService, TIBStatisticalService,
480        TIBLogService, TIBSecurityService, TIBServerProperties]);
481 <
481 >  end;
482  
483    RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid, TIBArrayGrid]);
484 +
485    RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize}
486 +  RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'FirebirdLibraryPathName', TIBLibraryNameProperty); {do not localize}
487 +  RegisterPropertyEditor(TypeInfo(TIBFileName), TIBXServicesConnection, 'FirebirdLibraryPathName', TIBLibraryNameProperty); {do not localize}
488    RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize}
489 +  RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'PackageName', TIBPackageNameProperty); {do not localize}
490    RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty);
491    RegisterPropertyEditor(TypeInfo(string), TIBTable, 'TableName', TIBTableNameProperty); {do not localize}
492    RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexName', TIBIndexNameProperty); {do not localize}
# Line 453 | Line 505 | begin
505    RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'ModifySQL', TIBUpdateSQLUpdateProperty); {do not localize}
506    RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'InsertSQL', TIBUpdateSQLInsertSQLProperty); {do not localize}
507    RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'DeleteSQL', TIBUpdateSQLDeleteProperty); {do not localize}
508 +  RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdate, 'RefreshSQL', TIBUpdateRefreshSQLProperty); {do not localize}
509    RegisterPropertyEditor(TypeInfo(TStrings), TIBEvents, 'Events', TIBEventListProperty); {do not localize}
510    RegisterPropertyEditor(TypeInfo(TPersistent), TIBDataSet, 'GeneratorField', TIBGeneratorProperty);  {do not localize}
511    RegisterPropertyEditor(TypeInfo(TPersistent), TIBQuery, 'GeneratorField', TIBGeneratorProperty);  {do not localize}
512 +  RegisterPropertyEditor(TypeInfo(TPersistent), TIBTable, 'GeneratorField', TIBGeneratorProperty);  {do not localize}
513  
514    RegisterComponentEditor(TIBDatabase, TIBDatabaseEditor);
515    RegisterComponentEditor(TIBTransaction, TIBTransactionEditor);
# Line 466 | Line 520 | begin
520    RegisterComponentEditor(TIBSQL, TIBSQLEditor);
521    RegisterComponentEditor(TIBCustomService, TIBServiceEditor);
522    RegisterComponentEditor(TIBArrayGrid, TIBArrayGridEditor);
523 +  RegisterComponentEditor(TIBXServicesConnection, TIBXServiceEditor);
524  
525  
526    {Firebird Data Access Controls}
# Line 477 | Line 532 | begin
532    RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'TextField', TIBTreeViewFieldProperty);
533    RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ParentField', TIBTreeViewFieldProperty);
534    RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'HasChildField', TIBTreeViewFieldProperty);
535 +  RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ImageIndexField', TIBTreeViewFieldProperty);
536 +  RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'SelectedIndexField', TIBTreeViewFieldProperty);
537  
538    IBGUIInterface :=  TIBDSLCLInterface.Create;
539   end;
# Line 503 | Line 560 | begin
560    end;
561   end;
562  
563 + { TIBLibraryNameProperty }
564 +
565 + function TIBLibraryNameProperty.GetFilter: string;
566 + begin
567 +  Result := SLibraryNameFilter; {do not localise}
568 + end;
569 +
570 + { TIBXServiceEditor }
571 +
572 + procedure TIBXServiceEditor.ExecuteVerb(Index: Integer);
573 + begin
574 +  if Index < inherited GetVerbCount then
575 +    inherited ExecuteVerb(Index) else
576 +  begin
577 +    Dec(Index, inherited GetVerbCount);
578 +    case Index of
579 +      0 : if IBXServiceEditor.EditIBXService(TIBXServicesConnection(Component)) then Designer.Modified;
580 +    end;
581 +  end;
582 + end;
583 +
584 + function TIBXServiceEditor.GetVerb(Index: Integer): string;
585 + begin
586 +  if Index < inherited GetVerbCount then
587 +    Result := inherited GetVerb(Index) else
588 +  begin
589 +    Dec(Index, inherited GetVerbCount);
590 +    case Index of
591 +      0: Result := SIBServiceEditor;
592 +      1 : Result := SInterbaseExpressVersion;
593 +    end;
594 +  end;
595 + end;
596 +
597 + function TIBXServiceEditor.GetVerbCount: Integer;
598 + begin
599 +  Result := inherited GetVerbCount + 2;
600 + end;
601 +
602 + { TIBUpdateRefreshSQLProperty }
603 +
604 + function TIBUpdateRefreshSQLProperty.GetObjects: boolean;
605 + begin
606 +  Result := false;
607 +  FIBUpdate := GetComponent(0) as TIBUpdate;
608 +  if not assigned(FIBUpdate) or not assigned(FIBUpdate.DataSet) then
609 +    Exit;
610 +  FDatabase := nil;
611 +  if FIBUpdate.DataSet is TIBQuery then
612 +  begin
613 +    FDatabase := (FIBUpdate.DataSet as TIBQuery).Database;
614 +    Result := true
615 +  end;
616 + end;
617 +
618 + procedure TIBUpdateRefreshSQLProperty.Edit;
619 + begin
620 +  GetObjects;
621 +  if IBRefreshSQLEditor.EditSQL(FIBUpdate.DataSet,FIBUpdate.RefreshSQL) then Modified;
622 + end;
623 +
624 + { TIBPackageNameProperty }
625 +
626 + procedure TIBPackageNameProperty.GetValues(Proc: TGetStrProc);
627 + var
628 +   StoredProc : TIBStoredProc;
629 +   i : integer;
630 + begin
631 +    StoredProc := GetComponent(0) as TIBStoredProc;
632 +    if StoredProc.Database = nil then
633 +      Exit;
634 +
635 +    with StoredProc do
636 +    try
637 +      for I := 0 to PackageNames.Count - 1 do
638 +        Proc (PackageNames[i]);
639 +    except on E: Exception do
640 +      MessageDlg(E.Message,mtError,[mbOK],0)
641 +    end;
642 + end;
643 +
644   { TIBIndexDefsProperty }
645  
646   procedure TIBIndexDefsProperty.Edit;
# Line 645 | Line 783 | begin
783    Result := inherited GetVerbCount + 2;
784   end;
785  
786 + function TIBFileNameProperty.GetFilter: string;
787 + begin
788 +  Result := SDatabaseFilter; {do not localize}
789 + end;
790 +
791   { TIBFileNameProperty }
792   procedure TIBFileNameProperty.Edit;
793   begin
794    with TOpenDialog.Create(Application) do
795      try
796        InitialDir := ExtractFilePath(GetStrValue);
797 <      Filter := SDatabaseFilter; {do not localize}
797 >      Filter := GetFilter;
798        if Execute then
799          SetStrValue(FileName);
800      finally
# Line 1040 | Line 1183 | begin
1183    Result := inherited GetVerbCount + 2;
1184   end;
1185  
1043 { TIBStoredProcParamsProperty }
1044
1045 procedure TIBStoredProcParamsProperty.Edit;
1046 var
1047  StoredProc: TIBStoredProc;
1048  Params: TParams;
1049 begin
1050  StoredProc := (GetComponent(0) as TIBStoredProc);
1051  Params := TParams.Create(nil);
1052  try
1053    StoredProc.CopyParams(Params);
1054  finally
1055    Params.Free;
1056  end;
1057  inherited Edit;
1058 end;
1059
1186   { TIBTableFieldLinkProperty }
1187  
1188   procedure TIBTableFieldLinkProperty.Edit;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines