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

Comparing ibx/trunk/design/IBDBReg.pas (file contents):
Revision 33 by tony, Sat Jul 18 12:30:52 2015 UTC vs.
Revision 126 by tony, Mon Jan 22 16:21:31 2018 UTC

# Line 39 | Line 39 | unit IBDBReg;
39   *)
40   {$A+}                           (* Aligned records: On *)
41   {$B-}                           (* Short circuit boolean expressions: Off *)
42 {$G+}                           (* Imported data: On *)
42   {$H+}                           (* Huge Strings: On *)
43   {$J-}                           (* Modification of Typed Constants: Off *)
44   {$M+}                           (* Generate run-time type information: On *)
# Line 47 | Line 46 | unit IBDBReg;
46   {$Q-}                           (* Overflow checks: Off *)
47   {$R-}                           (* Range checks: Off *)
48   {$T+}                           (* Typed address: On *)
50 {$U+}                           (* Pentim-safe FDIVs: On *)
49   {$W-}                           (* Always generate stack frames: Off *)
50   {$X+}                           (* Extended syntax: On *)
51   {$Z1}                           (* Minimum Enumeration Size: 1 Byte *)
# Line 56 | Line 54 | interface
54  
55   uses SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo,
56       DB, IBTable, IBDatabase,  IBEventsEditor,  LazarusPackageIntf,
57 <      IBUpdateSQL, IBXConst, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor,
57 >      IBUpdateSQL, IBUpdate, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor,
58       dbFieldLinkPropEditor, dbFieldListPropEditor, IBDialogs;
59  
60   type
# Line 85 | Line 83 | type
83      procedure GetValues(Proc: TGetStrProc); override;
84    end;
85  
86 +  { TIBPackageNameProperty
87 +    Editor for the TIBStoredProc.PackageName property.  Displays a drop-down list of all
88 +    the StoredProcedures in the Database.}
89 +  TIBPackageNameProperty = class(TIBNameProperty)
90 +  public
91 +    procedure GetValues(Proc: TGetStrProc); override;
92 +  end;
93 +
94    { TIBTableNameProperty
95      Editor for the TIBTable.TableName property.  Displays a drop-down list of all
96      the Tables in the Database.}
# Line 134 | Line 140 | type
140      function GetVerbCount: Integer; override;
141    end;
142  
143 +  { TIBArrayGridEditor }
144 +
145 +  TIBArrayGridEditor = class(TComponentEditor)
146 +  public
147 +    procedure ExecuteVerb(Index: Integer); override;
148 +    function GetVerb(Index: Integer): string; override;
149 +    function GetVerbCount: Integer; override;
150 +  end;
151 +
152   { TIBQueryEditor }
153  
154    TIBQueryEditor = class(TFieldsComponentEditor)
# Line 189 | Line 204 | type
204    end;
205  
206    TIBStoredProcParamsProperty = class(TCollectionPropertyEditor)
192  public
193    procedure Edit; override;
207    end;
208  
209    { TIBTableFieldLinkProperty }
# Line 309 | Line 322 | type
322      procedure Edit; override;
323    end;
324  
325 +  { TIBUpdateRefreshSQLProperty }
326 +
327 +  TIBUpdateRefreshSQLProperty = class(TSQLPropertyEditor)
328 +  protected
329 +    FIBUpdate: TIBUpdate;
330 +    FDatabase: TIBDatabase;
331 +    function GetObjects: boolean;
332 +  public
333 +    procedure Edit; override;
334 +  end;
335 +
336 +
337   { TIBEventListProperty }
338  
339    TIBEventListProperty = class(TClassProperty)
# Line 355 | Line 380 | type
380      procedure SetIndexFieldNames(const Value: string); override;
381    end;
382  
383 +  { TIBFieldDefsProperty }
384 +
385 +  TIBFieldDefsProperty = class(TCollectionPropertyEditor)
386 +  public
387 +    procedure Edit; override;
388 +  end;
389 +
390 +  { TIBIndexDefsProperty }
391 +
392 +  TIBIndexDefsProperty = class(TCollectionPropertyEditor)
393 +  public
394 +    procedure Edit; override;
395 +  end;
396  
397  
398   procedure Register;
399  
400   implementation
401  
402 < uses IB, IBQuery, IBStoredProc, IBCustomDataSet,
403 <     IBIntf, IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents,
402 > uses IB, IBQuery, IBStoredProc, IBCustomDataSet, FBMessages,
403 >     IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, IBTypes,
404       IBServices, IBDatabaseEdit, IBTransactionEdit,
405       IBBatchMove, IBExtract,LResources, IBSelectSQLEditor,
406       IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor,
407       IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor,
408       IBSQLEditor, ibserviceeditor, LCLVersion, IBDynamicGrid, IBLookupComboEditBox,
409 <     IBTreeView, DBControlGrid;
410 <
409 >     IBTreeView, DBControlGrid, ibxscript, IBLocalDBSupport, IBDSDialogs,
410 >     IBArrayGrid, IBVersion, IBDataOutput;
411  
412 + const
413 +  IBPalette1 = 'Firebird'; {do not localize}
414 +  IBPalette2 = 'Firebird Admin'; {do not localize}
415 +  IBPalette3 = 'Firebird Data Controls';   {do not localize}
416 +  
417 + resourcestring
418 +   SInterbaseExpressVersion = 'Firebird Express for Lazarus ' + IBX_VERSION;
419 +   SEditSQL = 'Edit SQL';
420 +   SIBSQLEditor = 'IBSQL Editor';
421 +   SIBServiceEditor = 'Edit IB Service';
422 +   SIBUpdateSQLEditor = '&UpdateSQL Editor...';
423 +   SIBDataSetEditor = '&Dataset Editor...';
424 +   SExecute = 'E&xecute';
425 +   SIBDatabaseEditor = 'Da&tabase Editor...';
426 +   SIBTransactionEditor = '&Transaction Editor...';
427 +   SIBUpdateLayout = 'Update Layout';
428  
429   procedure Register;
430   begin
# Line 380 | Line 434 | begin
434      Exit;
435    end;
436  
437 <  RegisterNoIcon([TIBStringField, TIBBCDField]);
437 >  RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField,
438 >    TIBSmallintField, TIBIntegerField, TIBLargeIntField]);
439    {$if lcl_fullversion < 01010000}
440    {see http://bugs.freepascal.org/view.php?id=19035 }
441    RegisterNoIcon([TIntegerField]);
442    {$endif}
443    RegisterComponents(IBPalette1, [ TIBQuery, TIBDataSet,
444 <   TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBEvents,
444 >   TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBUpdate, TIBEvents,
445       TIBSQL, TIBDatabaseInfo, TIBSQLMonitor,
446 <       TIBStoredProc,TIBBatchMove,  TIBTable,TIBExtract]);
447 <  if IBServiceAPIPresent  then
446 >       TIBStoredProc,TIBBatchMove,  TIBTable,TIBExtract, TIBXScript, TIBLocalDBSupport,
447 >       TIBBlockFormatOut,TIBCSVDataOut,TIBInsertStmtsOut]);
448 >  if FirebirdAPI.HasServiceAPI  then
449      RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService,
450        TIBRestoreService, TIBValidationService, TIBStatisticalService,
451        TIBLogService, TIBSecurityService, TIBServerProperties]);
452  
453  
454 <  RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid]);
454 >  RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid, TIBArrayGrid]);
455    RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize}
456    RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize}
457 +  RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'PackageName', TIBPackageNameProperty); {do not localize}
458    RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty);
459    RegisterPropertyEditor(TypeInfo(string), TIBTable, 'TableName', TIBTableNameProperty); {do not localize}
460    RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexName', TIBIndexNameProperty); {do not localize}
461    RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexFieldNames', TIBIndexFieldNamesProperty); {do not localize}
462    RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize}
463 +  RegisterPropertyEditor(TypeInfo(TFieldDefs), TIBTable, 'FieldDefs', TIBFieldDefsProperty); {do not localize}
464 +  RegisterPropertyEditor(TypeInfo(TIndexDefs), TIBTable, 'IndexDefs', TIBIndexDefsProperty); {do not localize}
465    RegisterPropertyEditor(TypeInfo(TStrings), TIBQuery, 'SQL', TIBQuerySQLProperty); {do not localize}
466    RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'SelectSQL', TIBDatasetSQLProperty); {do not localize}
467    RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'ModifySQL', TIBUpdateSQLProperty); {do not localize}
# Line 414 | Line 473 | begin
473    RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'ModifySQL', TIBUpdateSQLUpdateProperty); {do not localize}
474    RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'InsertSQL', TIBUpdateSQLInsertSQLProperty); {do not localize}
475    RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'DeleteSQL', TIBUpdateSQLDeleteProperty); {do not localize}
476 +  RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdate, 'RefreshSQL', TIBUpdateRefreshSQLProperty); {do not localize}
477    RegisterPropertyEditor(TypeInfo(TStrings), TIBEvents, 'Events', TIBEventListProperty); {do not localize}
478    RegisterPropertyEditor(TypeInfo(TPersistent), TIBDataSet, 'GeneratorField', TIBGeneratorProperty);  {do not localize}
479    RegisterPropertyEditor(TypeInfo(TPersistent), TIBQuery, 'GeneratorField', TIBGeneratorProperty);  {do not localize}
480 +  RegisterPropertyEditor(TypeInfo(TPersistent), TIBTable, 'GeneratorField', TIBGeneratorProperty);  {do not localize}
481  
482    RegisterComponentEditor(TIBDatabase, TIBDatabaseEditor);
483    RegisterComponentEditor(TIBTransaction, TIBTransactionEditor);
# Line 426 | Line 487 | begin
487    RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor);
488    RegisterComponentEditor(TIBSQL, TIBSQLEditor);
489    RegisterComponentEditor(TIBCustomService, TIBServiceEditor);
490 +  RegisterComponentEditor(TIBArrayGrid, TIBArrayGridEditor);
491  
492  
493    {Firebird Data Access Controls}
# Line 438 | Line 500 | begin
500    RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ParentField', TIBTreeViewFieldProperty);
501    RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'HasChildField', TIBTreeViewFieldProperty);
502  
503 +  IBGUIInterface :=  TIBDSLCLInterface.Create;
504   end;
505  
506   procedure LoadDataSourceFields(DataSource: TDataSource; List: TStrings);
# Line 462 | Line 525 | begin
525    end;
526   end;
527  
528 + { TIBUpdateRefreshSQLProperty }
529 +
530 + function TIBUpdateRefreshSQLProperty.GetObjects: boolean;
531 + begin
532 +  Result := false;
533 +  FIBUpdate := GetComponent(0) as TIBUpdate;
534 +  if not assigned(FIBUpdate) or not assigned(FIBUpdate.DataSet) then
535 +    Exit;
536 +  FDatabase := nil;
537 +  if FIBUpdate.DataSet is TIBQuery then
538 +  begin
539 +    FDatabase := (FIBUpdate.DataSet as TIBQuery).Database;
540 +    Result := true
541 +  end;
542 + end;
543 +
544 + procedure TIBUpdateRefreshSQLProperty.Edit;
545 + begin
546 +  GetObjects;
547 +  if IBRefreshSQLEditor.EditSQL(FIBUpdate.DataSet,FIBUpdate.RefreshSQL) then Modified;
548 + end;
549 +
550 + { TIBPackageNameProperty }
551 +
552 + procedure TIBPackageNameProperty.GetValues(Proc: TGetStrProc);
553 + var
554 +   StoredProc : TIBStoredProc;
555 +   i : integer;
556 + begin
557 +    StoredProc := GetComponent(0) as TIBStoredProc;
558 +    if StoredProc.Database = nil then
559 +      Exit;
560 +
561 +    with StoredProc do
562 +    try
563 +      for I := 0 to PackageNames.Count - 1 do
564 +        Proc (PackageNames[i]);
565 +    except on E: Exception do
566 +      MessageDlg(E.Message,mtError,[mbOK],0)
567 +    end;
568 + end;
569 +
570 + { TIBIndexDefsProperty }
571 +
572 + procedure TIBIndexDefsProperty.Edit;
573 + var IndexDefs: TIndexDefs;
574 + begin
575 +  IndexDefs := TIndexDefs(GetObjectValue);
576 +  if IndexDefs <> nil then
577 +    IndexDefs.Update;
578 +  inherited Edit;
579 + end;
580 +
581 + { TIBFieldDefsProperty }
582 +
583 + procedure TIBFieldDefsProperty.Edit;
584 + var FieldDefs: TFieldDefs;
585 + begin
586 +  FieldDefs := TFieldDefs(GetObjectValue);
587 +  if FieldDefs <> nil then
588 +    FieldDefs.Update;
589 +  inherited Edit;
590 + end;
591 +
592 + { TIBArrayGridEditor }
593 +
594 + procedure TIBArrayGridEditor.ExecuteVerb(Index: Integer);
595 + begin
596 +  if Index < inherited GetVerbCount then
597 +    inherited ExecuteVerb(Index)
598 +  else
599 +  case Index of
600 +    0: TIBArrayGrid(Component).UpdateLayout;
601 +  end;
602 + end;
603 +
604 + function TIBArrayGridEditor.GetVerb(Index: Integer): string;
605 + begin
606 +  if Index < inherited GetVerbCount then
607 +    Result := inherited GetVerb(Index) else
608 +  begin
609 +    Dec(Index, inherited GetVerbCount);
610 +    case Index of
611 +      0: Result := SIBUpdateLayout;
612 +      1 : Result := SInterbaseExpressVersion ;
613 +    end;
614 +  end;
615 + end;
616 +
617 + function TIBArrayGridEditor.GetVerbCount: Integer;
618 + begin
619 +  Result := 2;
620 + end;
621 +
622   { TDBLookupPropertiesGridFieldProperty }
623  
624   procedure TDBLookupPropertiesGridFieldProperty.FillValues(
# Line 742 | Line 899 | var
899    IBSQL: TIBSQL;
900   begin
901    IBSQL := GetComponent(0) as TIBSQL;
902 <  if IBSQLEditor.EditIBSQL(IBSQL) then Modified;
902 >  if IBSQLEditor.EditSQL(IBSQL) then Modified;
903   end;
904  
905   { TIBUpdateSQLEditor }
# Line 756 | Line 913 | function TIBUpdateSQLEditor.GetVerb(Inde
913   begin
914    case Index of
915      0 : Result := SIBUpdateSQLEditor;
916 <    1: Result := SInterbaseExpressVersion;
916 >    1: Result := SInterbaseExpressVersion ;
917    end;
918   end;
919  
# Line 768 | Line 925 | end;
925   { TIBDataSetEditor }
926  
927   procedure TIBDataSetEditor.ExecuteVerb(Index: Integer);
771 var
772  IBDataset: TIBDataset;
928   begin
929    if Index < inherited GetVerbCount then
930      inherited ExecuteVerb(Index) else
# Line 793 | Line 948 | begin
948      case Index of
949        0: Result := SIBDataSetEditor;
950        1: Result := SExecute;
951 <      2: Result := SInterbaseExpressVersion;
951 >      2: Result := SInterbaseExpressVersion ;
952      end;
953    end;
954   end;
# Line 850 | Line 1005 | begin
1005      Dec(Index, inherited GetVerbCount);
1006      case Index of
1007        0: Result := SIBDatabaseEditor;
1008 <      1 : Result := SInterbaseExpressVersion;
1008 >      1 : Result := SInterbaseExpressVersion ;
1009      end;
1010    end;
1011   end;
# Line 873 | Line 1028 | function TIBTransactionEditor.GetVerb(In
1028   begin
1029    case Index of
1030      0: Result := SIBTransactionEditor;
1031 <    1: Result := SInterbaseExpressVersion;
1031 >    1: Result := SInterbaseExpressVersion ;
1032    end;
1033   end;
1034  
# Line 909 | Line 1064 | begin
1064      case Index of
1065        0: Result := SExecute;
1066        1: Result := SEditSQL;
1067 <      2: Result := SInterbaseExpressVersion;
1067 >      2: Result := SInterbaseExpressVersion ;
1068      end;
1069    end;
1070   end;
# Line 939 | Line 1094 | begin
1094      Dec(Index, inherited GetVerbCount);
1095      case Index of
1096        0: Result := SExecute;
1097 <      1: Result := SInterbaseExpressVersion;
1097 >      1: Result := SInterbaseExpressVersion ;
1098      end;
1099    end;
1100   end;
# Line 949 | Line 1104 | begin
1104    Result := inherited GetVerbCount + 2;
1105   end;
1106  
952 { TIBStoredProcParamsProperty }
953
954 procedure TIBStoredProcParamsProperty.Edit;
955 var
956  StoredProc: TIBStoredProc;
957  Params: TParams;
958 begin
959  StoredProc := (GetComponent(0) as TIBStoredProc);
960  Params := TParams.Create(nil);
961  try
962    StoredProc.CopyParams(Params);
963  finally
964    Params.Free;
965  end;
966  inherited Edit;
967 end;
968
1107   { TIBTableFieldLinkProperty }
1108  
1109   procedure TIBTableFieldLinkProperty.Edit;
# Line 1024 | Line 1162 | end;
1162   procedure TIBRefreshSQLProperty.Edit;
1163   var
1164    IBDataset: TIBDataset;
1027  aDatabase: TIBDatabase;
1165   begin
1166    IBDataset := GetComponent(0) as TIBDataset;
1167    if IBRefreshSQLEditor.EditSQL(IBDataSet,IBDataSet.RefreshSQL) then Modified;
# Line 1111 | Line 1248 | end;
1248  
1249   procedure TIBSQLEditor.ExecuteVerb(Index: Integer);
1250   begin
1251 <  if IBSQLEditor.EditIBSQL(TIBSQL(Component)) then Modified;
1251 >  if IBSQLEditor.EditSQL(TIBSQL(Component)) then Modified;
1252   end;
1253  
1254   function TIBSQLEditor.GetVerb(Index: Integer): string;
1255   begin
1256    case Index of
1257      0 : Result := SIBSQLEditor;
1258 <    1: Result := SInterbaseExpressVersion;
1258 >    1: Result := SInterbaseExpressVersion ;
1259    end;
1260   end;
1261  
# Line 1134 | Line 1271 | var
1271    IBSQL: TIBSQL;
1272   begin
1273    IBSQL := GetComponent(0) as TIBSQL;
1274 <  if IBSQLEditor.EditIBSQL(IBSQL) then Modified;
1274 >  if IBSQLEditor.EditSQL(IBSQL) then Modified;
1275   end;
1276  
1277   initialization

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines