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 107 by tony, Thu Jan 18 14:37:40 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 203 | Line 212 | type
212     function GetVerbCount: Integer; override;
213    end;
214  
215 +  { TIBXServiceEditor }
216 +
217 +  TIBXServiceEditor = class(TComponentEditor)
218 +  public
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  
# Line 322 | 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 387 | 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 416 | 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);
# Line 423 | Line 455 | begin
455    end;
456  
457    RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField,
458 <    TIBSmallintField, TIBIntegerField, TIBLargeIntField]);
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 434 | 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);
# Line 461 | 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}
# Line 475 | 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 486 | 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 512 | 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);
# Line 674 | 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines