ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/IBDBReg.pas
Revision: 7
Committed: Sun Aug 5 18:28:19 2012 UTC (12 years, 3 months ago) by tony
Content type: text/x-pascal
File size: 26909 byte(s)
Log Message:
Committing updates for Release R1-0-0

File Contents

# User Rev Content
1 tony 1 {************************************************************************}
2     { }
3     { Borland Delphi Visual Component Library }
4     { InterBase Express core components }
5     { }
6     { Copyright (c) 1998-2000 Inprise Corporation }
7     { }
8     { InterBase Express is based in part on the product }
9     { Free IB Components, written by Gregory H. Deatz for }
10     { Hoagland, Longo, Moran, Dunst & Doukas Company. }
11     { Free IB Components is used under license. }
12     { }
13     { The contents of this file are subject to the InterBase }
14     { Public License Version 1.0 (the "License"); you may not }
15     { use this file except in compliance with the License. You }
16     { may obtain a copy of the License at http://www.Inprise.com/IPL.html }
17     { Software distributed under the License is distributed on }
18     { an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either }
19     { express or implied. See the License for the specific language }
20     { governing rights and limitations under the License. }
21     { The Original Code was created by InterBase Software Corporation }
22     { and its successors. }
23     { Portions created by Inprise Corporation are Copyright (C) Inprise }
24     { Corporation. All Rights Reserved. }
25     { Contributor(s): Jeff Overcash }
26     { }
27 tony 7 { 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 }
31 tony 1 {************************************************************************}
32    
33     unit IBDBReg;
34    
35 tony 5 {$MODE Delphi}
36    
37 tony 1 (*
38     * Compiler defines
39     *)
40     {$A+} (* Aligned records: On *)
41     {$B-} (* Short circuit boolean expressions: Off *)
42     {$G+} (* Imported data: On *)
43     {$H+} (* Huge Strings: On *)
44     {$J-} (* Modification of Typed Constants: Off *)
45     {$M+} (* Generate run-time type information: On *)
46     {$O+} (* Optimization: On *)
47     {$Q-} (* Overflow checks: Off *)
48     {$R-} (* Range checks: Off *)
49     {$T+} (* Typed address: On *)
50     {$U+} (* Pentim-safe FDIVs: On *)
51     {$W-} (* Always generate stack frames: Off *)
52     {$X+} (* Extended syntax: On *)
53     {$Z1} (* Minimum Enumeration Size: 1 Byte *)
54    
55     interface
56    
57 tony 5 uses {Windows,} SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo,
58 tony 7 DB, IBTable, IBDatabase, IBEventsEditor, LazarusPackageIntf,
59 tony 5 IBUpdateSQL, IBXConst, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor;
60 tony 1
61     type
62    
63     { TIBFileNameProperty
64     Property editor the DataBase Name property. Brings up the Open dialog }
65    
66     TIBFileNameProperty = class(TStringProperty)
67     public
68     procedure Edit; override;
69     function GetAttributes: TPropertyAttributes; override;
70     end;
71    
72     { TIBNameProperty
73     }
74     TIBNameProperty = class(TStringProperty)
75     public
76     function GetAttributes: TPropertyAttributes; override;
77     end;
78    
79     { TIBStoredProcNameProperty
80     Editor for the TIBStoredProc.StoredProcName property. Displays a drop-down list of all
81     the StoredProcedures in the Database.}
82     TIBStoredProcNameProperty = class(TIBNameProperty)
83     public
84     procedure GetValues(Proc: TGetStrProc); override;
85     end;
86    
87     { TIBTableNameProperty
88     Editor for the TIBTable.TableName property. Displays a drop-down list of all
89     the Tables in the Database.}
90     TIBTableNameProperty = class(TIBNameProperty)
91     public
92     procedure GetValues(Proc: TGetStrProc); override;
93     end;
94    
95     TDBStringProperty = class(TStringProperty)
96     public
97     function GetAttributes: TPropertyAttributes; override;
98     procedure GetValueList(List: TStrings); virtual;
99     procedure GetValues(Proc: TGetStrProc); override;
100     end;
101    
102     TIBIndexFieldNamesProperty = class(TDBStringProperty)
103     public
104     procedure GetValueList(List: TStrings); override;
105     end;
106    
107     TIBIndexNameProperty = class(TDBStringProperty)
108     public
109     procedure GetValueList(List: TStrings); override;
110     end;
111    
112     { TIBDatabaseEditor }
113    
114     TIBDatabaseEditor = class(TComponentEditor)
115     procedure ExecuteVerb(Index: Integer); override;
116     function GetVerb(Index: Integer): string; override;
117     function GetVerbCount: Integer; override;
118     end;
119    
120     { TIBTransactionEditor }
121    
122     TIBTransactionEditor = class(TComponentEditor)
123     public
124     procedure ExecuteVerb(Index: Integer); override;
125     function GetVerb(Index: Integer): string; override;
126     function GetVerbCount: Integer; override;
127     end;
128    
129     { TIBQueryEditor }
130    
131 tony 7 TIBQueryEditor = class(TFieldsComponentEditor)
132 tony 1 public
133     procedure ExecuteVerb(Index: Integer); override;
134     function GetVerb(Index: Integer): string; override;
135     function GetVerbCount: Integer; override;
136     end;
137    
138     { TIBStoredProcEditor }
139    
140 tony 7 TIBStoredProcEditor = class(TFieldsComponentEditor)
141 tony 1 public
142     procedure ExecuteVerb(Index: Integer); override;
143     function GetVerb(Index: Integer): string; override;
144     function GetVerbCount: Integer; override;
145     end;
146    
147     { TIBDataSetEditor }
148    
149 tony 7 TIBDataSetEditor = class(TFieldsComponentEditor)
150 tony 1 public
151     procedure ExecuteVerb(Index: Integer); override;
152     function GetVerb(Index: Integer): string; override;
153     function GetVerbCount: Integer; override;
154     end;
155    
156     { TIBUpdateSQLEditor }
157    
158     TIBUpdateSQLEditor = class(TComponentEditor)
159     public
160     procedure ExecuteVerb(Index: Integer); override;
161     function GetVerb(Index: Integer): string; override;
162     function GetVerbCount: Integer; override;
163     end;
164    
165 tony 7 { TIBSQLEditor }
166    
167     TIBSQLEditor = class(TComponentEditor)
168     public
169     procedure ExecuteVerb(Index: Integer); override;
170     function GetVerb(Index: Integer): string; override;
171     function GetVerbCount: Integer; override;
172     end;
173    
174     { TIBServiceEditor}
175    
176     TIBServiceEditor = class(TComponentEditor)
177     public
178     procedure ExecuteVerb(Index: Integer); override;
179     function GetVerb(Index: Integer): string; override;
180     function GetVerbCount: Integer; override;
181     end;
182    
183 tony 5 TIBStoredProcParamsProperty = class(TCollectionPropertyEditor)
184 tony 1 public
185     procedure Edit; override;
186     end;
187 tony 5 (*
188 tony 1 TIBTableFieldLinkProperty = class(TFieldLinkProperty)
189     private
190     FTable: TIBTable;
191     protected
192     function GetIndexFieldNames: string; override;
193     function GetMasterFields: string; override;
194     procedure SetIndexFieldNames(const Value: string); override;
195     procedure SetMasterFields(const Value: string); override;
196     public
197     procedure Edit; override;
198     end;
199 tony 5 *)
200 tony 1 { TSQLPropertyEditor }
201    
202 tony 5 TSQLPropertyEditor = class(TStringsPropertyEditor)
203 tony 1 public
204     function GetAttributes: TPropertyAttributes; override;
205     end;
206    
207     { TIBQuerySQLProperty }
208    
209     TIBQuerySQLProperty = class(TSQLPropertyEditor)
210     public
211     procedure Edit; override;
212     end;
213    
214 tony 7 {TIBSQLSQLPropertyEditor }
215    
216     TIBSQLSQLPropertyEditor = class(TSQLPropertyEditor)
217     public
218     procedure Edit; override;
219     end;
220    
221 tony 1 { TIBDatasetSQLProperty }
222    
223     TIBDatasetSQLProperty = class(TSQLPropertyEditor)
224     public
225     procedure Edit; override;
226     end;
227    
228     { TIBSQLProperty }
229    
230     TIBSQLProperty = class(TSQLPropertyEditor)
231     public
232     procedure Edit; override;
233     end;
234    
235 tony 5 { TUpdateSQLPropertyEditor }
236    
237     TUpdateSQLPropertyEditor = class(TSQLPropertyEditor)
238     protected
239     FIBUpdateSQL: TIBUpdateSQL;
240     FDatabase: TIBDatabase;
241     function GetObjects: boolean;
242     end;
243    
244     { TIBUpdateSQLProperty }
245    
246     TIBUpdateSQLProperty = class(TSQLPropertyEditor)
247 tony 1 public
248     procedure Edit; override;
249     end;
250    
251 tony 5 { TIBRefreshSQLProperty }
252 tony 1
253 tony 5 TIBRefreshSQLProperty = class(TSQLPropertyEditor)
254 tony 1 public
255 tony 5 procedure Edit; override;
256 tony 1 end;
257    
258 tony 5 { TIBInsertSQLProperty }
259 tony 1
260 tony 5 TIBInsertSQLProperty = class(TSQLPropertyEditor)
261 tony 1 public
262 tony 5 procedure Edit; override;
263 tony 1 end;
264    
265 tony 5 { TIBDeleteSQLProperty }
266 tony 1
267 tony 5 TIBDeleteSQLProperty = class(TSQLPropertyEditor)
268 tony 1 public
269 tony 5 procedure Edit; override;
270 tony 1 end;
271    
272 tony 5 { TIBUpdateSQLUpdateProperty }
273 tony 1
274 tony 5 TIBUpdateSQLUpdateProperty = class(TUpdateSQLPropertyEditor)
275 tony 1 public
276 tony 5 procedure Edit; override;
277 tony 1 end;
278    
279 tony 5 { TIBUpdateSQLRefreshSQLProperty }
280 tony 1
281 tony 5 TIBUpdateSQLRefreshSQLProperty = class(TUpdateSQLPropertyEditor)
282 tony 1 public
283 tony 5 procedure Edit; override;
284 tony 1 end;
285    
286 tony 5 { TIBUpdateSQLInsertSQLProperty }
287 tony 1
288 tony 5 TIBUpdateSQLInsertSQLProperty = class(TUpdateSQLPropertyEditor)
289 tony 1 public
290 tony 5 procedure Edit; override;
291 tony 1 end;
292    
293 tony 5 { TIBUpdateSQLDeleteProperty }
294 tony 1
295 tony 5 TIBUpdateSQLDeleteProperty = class(TUpdateSQLPropertyEditor)
296 tony 1 public
297 tony 5 function GetAttributes: TPropertyAttributes; override;
298     procedure Edit; override;
299 tony 1 end;
300    
301 tony 5 { TIBEventListProperty }
302 tony 1
303 tony 5 TIBEventListProperty = class(TClassProperty)
304 tony 1 public
305 tony 5 function GetAttributes: TPropertyAttributes; override;
306     procedure Edit; override;
307 tony 1 end;
308    
309 tony 5 {TIBGeneratorProperty}
310 tony 1
311 tony 5 TIBGeneratorProperty = class(TPersistentPropertyEditor)
312 tony 1 public
313 tony 5 function GetAttributes: TPropertyAttributes; override;
314     procedure Edit; override;
315 tony 1 end;
316    
317     procedure Register;
318    
319     implementation
320    
321 tony 5 uses IB, IBQuery, IBStoredProc, IBCustomDataSet,
322 tony 7 IBIntf, IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents,
323     IBServices, IBDatabaseEdit, IBTransactionEdit,
324 tony 5 IBBatchMove, DBLoginDlg, IBExtract,LResources, IBSelectSQLEditor,
325     IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor,
326 tony 7 IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor,
327     IBSQLEditor, ibserviceeditor;
328 tony 1
329 tony 7
330    
331 tony 1 procedure Register;
332     begin
333 tony 7 if not TryIBLoad then Exit;
334    
335     RegisterNoIcon([TIBStringField, TIBBCDField]);
336     RegisterNoIcon([TIntegerField]);
337     RegisterComponents(IBPalette1, [ TIBQuery, TIBDataSet,
338     TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBEvents,
339     TIBSQL, TIBDatabaseInfo, TIBSQLMonitor,
340     TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract]);
341     if IBServiceAPIPresent then
342 tony 1 RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService,
343     TIBRestoreService, TIBValidationService, TIBStatisticalService,
344 tony 5 TIBLogService, TIBSecurityService, TIBServerProperties]);
345 tony 1 RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize}
346     RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize}
347     RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty);
348     RegisterPropertyEditor(TypeInfo(string), TIBTable, 'TableName', TIBTableNameProperty); {do not localize}
349     RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexName', TIBIndexNameProperty); {do not localize}
350     RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexFieldNames', TIBIndexFieldNamesProperty); {do not localize}
351 tony 5 // RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize}
352 tony 1 RegisterPropertyEditor(TypeInfo(TStrings), TIBQuery, 'SQL', TIBQuerySQLProperty); {do not localize}
353     RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'SelectSQL', TIBDatasetSQLProperty); {do not localize}
354 tony 5 RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'ModifySQL', TIBUpdateSQLProperty); {do not localize}
355     RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'InsertSQL', TIBInsertSQLProperty); {do not localize}
356     RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'RefreshSQL', TIBRefreshSQLProperty); {do not localize}
357     RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'DeleteSQL', TIBDeleteSQLProperty); {do not localize}
358 tony 7 RegisterPropertyEditor(TypeInfo(TStrings), TIBSQL, 'SQL', TIBSQLSQLPropertyEditor); {do not localize}
359 tony 5 RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'RefreshSQL', TIBUpdateSQLRefreshSQLProperty); {do not localize}
360     RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'ModifySQL', TIBUpdateSQLUpdateProperty); {do not localize}
361     RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'InsertSQL', TIBUpdateSQLInsertSQLProperty); {do not localize}
362     RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'DeleteSQL', TIBUpdateSQLDeleteProperty); {do not localize}
363 tony 1 RegisterPropertyEditor(TypeInfo(TStrings), TIBEvents, 'Events', TIBEventListProperty); {do not localize}
364 tony 7 RegisterPropertyEditor(TypeInfo(TPersistent), TIBDataSet, 'GeneratorField', TIBGeneratorProperty); {do not localize}
365     RegisterPropertyEditor(TypeInfo(TPersistent), TIBQuery, 'GeneratorField', TIBGeneratorProperty); {do not localize}
366 tony 1
367     RegisterComponentEditor(TIBDatabase, TIBDatabaseEditor);
368     RegisterComponentEditor(TIBTransaction, TIBTransactionEditor);
369     RegisterComponentEditor(TIBUpdateSQL, TIBUpdateSQLEditor);
370     RegisterComponentEditor(TIBDataSet, TIBDataSetEditor);
371     RegisterComponentEditor(TIBQuery, TIBQueryEditor);
372     RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor);
373 tony 7 RegisterComponentEditor(TIBSQL, TIBSQLEditor);
374     RegisterComponentEditor(TIBCustomService, TIBServiceEditor);
375 tony 1 end;
376    
377 tony 7 { TIBServiceEditor }
378    
379     procedure TIBServiceEditor.ExecuteVerb(Index: Integer);
380     begin
381     if Index < inherited GetVerbCount then
382     inherited ExecuteVerb(Index) else
383     begin
384     Dec(Index, inherited GetVerbCount);
385     case Index of
386     0 : if ibserviceeditor.EditIBService(TIBCustomService(Component)) then Designer.Modified;
387     end;
388     end;
389     end;
390    
391     function TIBServiceEditor.GetVerb(Index: Integer): string;
392     begin
393     if Index < inherited GetVerbCount then
394     Result := inherited GetVerb(Index) else
395     begin
396     Dec(Index, inherited GetVerbCount);
397     case Index of
398     0: Result := SIBServiceEditor;
399     1 : Result := SInterbaseExpressVersion;
400     end;
401     end;
402     end;
403    
404     function TIBServiceEditor.GetVerbCount: Integer;
405     begin
406     Result := inherited GetVerbCount + 2;
407     end;
408    
409 tony 1 { TIBFileNameProperty }
410     procedure TIBFileNameProperty.Edit;
411     begin
412     with TOpenDialog.Create(Application) do
413     try
414     InitialDir := ExtractFilePath(GetStrValue);
415 tony 7 Filter := SDatabaseFilter; {do not localize}
416 tony 1 if Execute then
417     SetStrValue(FileName);
418     finally
419     Free
420     end;
421     end;
422    
423     function TIBFileNameProperty.GetAttributes: TPropertyAttributes;
424     begin
425     Result := [paDialog];
426     end;
427    
428     { TIBNameProperty }
429    
430     function TIBNameProperty.GetAttributes: TPropertyAttributes;
431     begin
432     Result := [paValueList, paSortList];
433     end;
434    
435     { TIBStoredProcNameProperty }
436    
437     procedure TIBStoredProcNameProperty.GetValues(Proc: TGetStrProc);
438     var
439     StoredProc : TIBStoredProc;
440     i : integer;
441     begin
442     StoredProc := GetComponent(0) as TIBStoredProc;
443 tony 7 if StoredProc.Database = nil then
444     Exit;
445    
446 tony 1 with StoredProc do
447 tony 7 try
448 tony 1 for I := 0 to StoredProcedureNames.Count - 1 do
449     Proc (StoredProcedureNames[i]);
450 tony 7 except on E: Exception do
451     MessageDlg(E.Message,mtError,[mbOK],0)
452     end;
453 tony 1 end;
454    
455     { TIBTableNameProperty }
456    
457     procedure TIBTableNameProperty.GetValues(Proc: TGetStrProc);
458     var
459     TableName : TIBTable;
460     i : integer;
461     begin
462     TableName := GetComponent(0) as TIBTable;
463     with TableName do
464     for I := 0 to TableNames.Count - 1 do
465     Proc (TableNames[i]);
466     end;
467    
468     { TDBStringProperty }
469    
470     function TDBStringProperty.GetAttributes: TPropertyAttributes;
471     begin
472     Result := [paValueList, paSortList, paMultiSelect];
473     end;
474    
475     procedure TDBStringProperty.GetValueList(List: TStrings);
476     begin
477     end;
478    
479     procedure TDBStringProperty.GetValues(Proc: TGetStrProc);
480     var
481     I: Integer;
482     Values: TStringList;
483     begin
484     Values := TStringList.Create;
485     try
486     GetValueList(Values);
487     for I := 0 to Values.Count - 1 do Proc(Values[I]);
488     finally
489     Values.Free;
490     end;
491     end;
492    
493     { Utility Functions }
494    
495     function GetPropertyValue(Instance: TPersistent; const PropName: string): TPersistent;
496     var
497     PropInfo: PPropInfo;
498     begin
499     Result := nil;
500     PropInfo := TypInfo.GetPropInfo(Instance.ClassInfo, PropName);
501     if (PropInfo <> nil) and (PropInfo^.PropType^.Kind = tkClass) then
502     Result := TObject(GetOrdProp(Instance, PropInfo)) as TPersistent;
503     end;
504    
505     function GetIndexDefs(Component: TPersistent): TIndexDefs;
506     var
507     DataSet: TDataSet;
508     begin
509     DataSet := Component as TDataSet;
510     Result := GetPropertyValue(DataSet, 'IndexDefs') as TIndexDefs; {do not localize}
511     if Assigned(Result) then
512     begin
513     Result.Updated := False;
514     Result.Update;
515     end;
516     end;
517    
518     { TIBIndexFieldNamesProperty }
519    
520     procedure TIBIndexFieldNamesProperty.GetValueList(List: TStrings);
521     var
522     I: Integer;
523     IndexDefs: TIndexDefs;
524     begin
525     IndexDefs := GetIndexDefs(GetComponent(0));
526     for I := 0 to IndexDefs.Count - 1 do
527     with IndexDefs[I] do
528     if (Options * [ixExpression, ixDescending] = []) and (Fields <> '') then
529     List.Add(Fields);
530     end;
531    
532    
533     { TIBIndexNameProperty }
534    
535     procedure TIBIndexNameProperty.GetValueList(List: TStrings);
536     begin
537     GetIndexDefs(GetComponent(0)).GetItemNames(List);
538     end;
539    
540     { TSQLPropertyEditor }
541    
542     function TSQLPropertyEditor.GetAttributes: TPropertyAttributes;
543     begin
544 tony 5 Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties];
545 tony 1 end;
546    
547     { TIBQuerySQLProperty }
548    
549     procedure TIBQuerySQLProperty.Edit;
550     var
551     Query: TIBQuery;
552     begin
553 tony 5 Query := GetComponent(0) as TIBQuery;
554 tony 7 if IBSelectSQLEditor.EditSQL(Query.Database,Query.SQL) then Modified;
555 tony 1 end;
556    
557     { TIBDatasetSQLProperty }
558    
559     procedure TIBDatasetSQLProperty.Edit;
560     var
561     IBDataset: TIBDataset;
562     begin
563 tony 5 IBDataset := GetComponent(0) as TIBDataset;
564 tony 7 if IBSelectSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.SelectSQL) then Modified;
565 tony 1 end;
566    
567     { TIBSQLProperty }
568    
569     procedure TIBSQLProperty.Edit;
570     var
571     IBSQL: TIBSQL;
572     begin
573 tony 5 IBSQL := GetComponent(0) as TIBSQL;
574 tony 7 if IBSelectSQLEditor.EditSQL(IBSQL.Database,IBSQL.SQL) then Modified;
575 tony 1 end;
576    
577     { TIBUpdateSQLEditor }
578    
579     procedure TIBUpdateSQLEditor.ExecuteVerb(Index: Integer);
580     begin
581 tony 5 if IBUpdateSQLEditor.EditIBUpdateSQL(TIBUpdateSQL(Component)) then Modified;
582 tony 1 end;
583    
584     function TIBUpdateSQLEditor.GetVerb(Index: Integer): string;
585     begin
586     case Index of
587     0 : Result := SIBUpdateSQLEditor;
588 tony 5 1: Result := SInterbaseExpressVersion;
589 tony 1 end;
590     end;
591    
592     function TIBUpdateSQLEditor.GetVerbCount: Integer;
593     begin
594 tony 7 Result := 2;
595 tony 1 end;
596    
597     { TIBDataSetEditor }
598    
599     procedure TIBDataSetEditor.ExecuteVerb(Index: Integer);
600     var
601     IBDataset: TIBDataset;
602     begin
603 tony 7 if Index < inherited GetVerbCount then
604     inherited ExecuteVerb(Index) else
605     begin
606     Dec(Index, inherited GetVerbCount);
607 tony 1 case Index of
608     0:
609 tony 5 if IBDataSetEditor.EditIBDataSet(TIBDataSet(Component)) then
610 tony 1 Designer.Modified;
611     1: (Component as TIBDataSet).ExecSQL;
612     end;
613 tony 7 end;
614 tony 1 end;
615    
616     function TIBDataSetEditor.GetVerb(Index: Integer): string;
617     begin
618     if Index < inherited GetVerbCount then
619     Result := inherited GetVerb(Index) else
620     begin
621     Dec(Index, inherited GetVerbCount);
622     case Index of
623     0: Result := SIBDataSetEditor;
624     1: Result := SExecute;
625 tony 5 2: Result := SInterbaseExpressVersion;
626 tony 1 end;
627     end;
628     end;
629    
630     function TIBDataSetEditor.GetVerbCount: Integer;
631     begin
632 tony 7 Result := inherited GetVerbCount + 3;
633 tony 1 end;
634    
635     { TIBEventListProperty }
636    
637     function TIBEventListProperty.GetAttributes: TPropertyAttributes;
638     begin
639 tony 5 Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties];
640 tony 1 end;
641    
642     procedure TIBEventListProperty.Edit;
643     var
644     Events: TStrings;
645 tony 5 IBEvents: TIBEvents;
646 tony 1 begin
647 tony 5 IBEvents := GetComponent(0) as TIBEvents;
648 tony 1 Events := TStringList.Create;
649     try
650 tony 5 Events.Assign( IBEvents.Events);
651 tony 7 if EditAlerterEvents( Events) then
652     begin
653     IBEvents.Events.Assign(Events);
654     Modified
655     end;
656 tony 1 finally
657     Events.Free;
658     end;
659     end;
660    
661     { TIBDatabaseEditor }
662     procedure TIBDatabaseEditor.ExecuteVerb(Index: Integer);
663     begin
664     if Index < inherited GetVerbCount then
665     inherited ExecuteVerb(Index) else
666     begin
667     Dec(Index, inherited GetVerbCount);
668     case Index of
669     0 : if EditIBDatabase(TIBDatabase(Component)) then Designer.Modified;
670     end;
671     end;
672     end;
673    
674     function TIBDatabaseEditor.GetVerb(Index: Integer): string;
675     begin
676     if Index < inherited GetVerbCount then
677     Result := inherited GetVerb(Index) else
678     begin
679     Dec(Index, inherited GetVerbCount);
680     case Index of
681     0: Result := SIBDatabaseEditor;
682     1 : Result := SInterbaseExpressVersion;
683     end;
684     end;
685     end;
686    
687     function TIBDatabaseEditor.GetVerbCount: Integer;
688     begin
689     Result := inherited GetVerbCount + 2;
690     end;
691    
692     { TIBTransactionEditor }
693    
694     procedure TIBTransactionEditor.ExecuteVerb(Index: Integer);
695     begin
696     case Index of
697     0: if EditIBTransaction(TIBTransaction(Component)) then Designer.Modified;
698     end;
699     end;
700    
701     function TIBTransactionEditor.GetVerb(Index: Integer): string;
702     begin
703     case Index of
704     0: Result := SIBTransactionEditor;
705     1: Result := SInterbaseExpressVersion;
706     end;
707     end;
708    
709     function TIBTransactionEditor.GetVerbCount: Integer;
710     begin
711     Result := 2;
712     end;
713    
714     { TIBQueryEditor }
715    
716     procedure TIBQueryEditor.ExecuteVerb(Index: Integer);
717     var
718     Query: TIBQuery;
719     begin
720 tony 7 if Index < inherited GetVerbCount then
721     inherited ExecuteVerb(Index) else
722     begin
723 tony 1 Query := Component as TIBQuery;
724     Dec(Index, inherited GetVerbCount);
725     case Index of
726     0: Query.ExecSQL;
727 tony 7 1: if ibselectsqleditor.EditSQL(Query.Database,Query.SQL) then Designer.Modified;
728 tony 1 end;
729 tony 7 end;
730 tony 1 end;
731    
732     function TIBQueryEditor.GetVerb(Index: Integer): string;
733     begin
734     if Index < inherited GetVerbCount then
735     Result := inherited GetVerb(Index) else
736     begin
737     Dec(Index, inherited GetVerbCount);
738     case Index of
739     0: Result := SExecute;
740     1: Result := SEditSQL;
741     2: Result := SInterbaseExpressVersion;
742     end;
743     end;
744     end;
745    
746     function TIBQueryEditor.GetVerbCount: Integer;
747     begin
748 tony 7 Result := inherited GetVerbCount + 3;
749 tony 1 end;
750    
751     { TIBStoredProcEditor }
752    
753     procedure TIBStoredProcEditor.ExecuteVerb(Index: Integer);
754     begin
755 tony 7 if Index < inherited GetVerbCount then
756     inherited ExecuteVerb(Index) else
757     begin
758     Dec(Index, inherited GetVerbCount);
759 tony 1 if Index = 0 then (Component as TIBStoredProc).ExecProc;
760 tony 7 end;
761 tony 1 end;
762    
763     function TIBStoredProcEditor.GetVerb(Index: Integer): string;
764     begin
765 tony 7 if Index < inherited GetVerbCount then
766     Result := inherited GetVerb(Index) else
767     begin
768     Dec(Index, inherited GetVerbCount);
769 tony 1 case Index of
770     0: Result := SExecute;
771     1: Result := SInterbaseExpressVersion;
772     end;
773 tony 7 end;
774 tony 1 end;
775    
776     function TIBStoredProcEditor.GetVerbCount: Integer;
777     begin
778     Result := inherited GetVerbCount + 2;
779     end;
780    
781     { TIBStoredProcParamsProperty }
782    
783     procedure TIBStoredProcParamsProperty.Edit;
784     var
785     StoredProc: TIBStoredProc;
786     Params: TParams;
787     begin
788     StoredProc := (GetComponent(0) as TIBStoredProc);
789     Params := TParams.Create(nil);
790     try
791     StoredProc.CopyParams(Params);
792     finally
793     Params.Free;
794     end;
795     inherited Edit;
796     end;
797 tony 5 (*
798 tony 1 { TIBTableFieldLinkProperty }
799    
800     procedure TIBTableFieldLinkProperty.Edit;
801     begin
802     FTable := DataSet as TIBTable;
803     inherited Edit;
804     end;
805    
806     function TIBTableFieldLinkProperty.GetIndexFieldNames: string;
807     begin
808     Result := FTable.IndexFieldNames;
809     end;
810    
811     function TIBTableFieldLinkProperty.GetMasterFields: string;
812     begin
813     Result := FTable.MasterFields;
814     end;
815    
816     procedure TIBTableFieldLinkProperty.SetIndexFieldNames(const Value: string);
817     begin
818     FTable.IndexFieldNames := Value;
819     end;
820    
821     procedure TIBTableFieldLinkProperty.SetMasterFields(const Value: string);
822     begin
823     FTable.MasterFields := Value;
824 tony 5 end;*)
825 tony 1
826 tony 5 { TIBUpdateSQLProperty }
827 tony 1
828 tony 5 procedure TIBUpdateSQLProperty.Edit;
829     var
830     IBDataset: TIBDataset;
831 tony 1 begin
832 tony 5 IBDataset := GetComponent(0) as TIBDataset;
833 tony 7 if IBModifySQLEditor.EditSQL(IBDataSet.Database,IBDataSet.ModifySQL) then Modified;
834 tony 1 end;
835    
836 tony 5 { TIBUpdateSQLUpdateProperty }
837 tony 1
838 tony 5 procedure TIBUpdateSQLUpdateProperty.Edit;
839 tony 1 begin
840 tony 7 GetObjects;
841     if IBModifySQLEditor.EditSQL(FDatabase,FIBUpdateSQL.ModifySQL) then Modified;
842 tony 1 end;
843    
844 tony 5 { TIBRefreshSQLProperty }
845 tony 1
846 tony 5 procedure TIBRefreshSQLProperty.Edit;
847     var
848     IBDataset: TIBDataset;
849 tony 7 aDatabase: TIBDatabase;
850 tony 1 begin
851 tony 5 IBDataset := GetComponent(0) as TIBDataset;
852 tony 7 if IBRefreshSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.RefreshSQL) then Modified;
853 tony 1 end;
854    
855 tony 5 { TIBUpdateSQLRefreshSQLProperty }
856 tony 1
857 tony 5 procedure TIBUpdateSQLRefreshSQLProperty.Edit;
858 tony 1 begin
859 tony 7 GetObjects;
860     if IBRefreshSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.RefreshSQL) then Modified;
861 tony 1 end;
862    
863 tony 5 { TIBDeleteSQLProperty }
864 tony 1
865 tony 5 procedure TIBDeleteSQLProperty.Edit;
866 tony 1 var
867 tony 5 IBDataset: TIBDataset;
868 tony 1 begin
869 tony 5 IBDataset := GetComponent(0) as TIBDataset;
870 tony 7 if IBDeleteSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.DeleteSQL) then Modified;
871 tony 1 end;
872    
873 tony 5 { TIBUpdateSQLDeleteProperty }
874 tony 1
875 tony 5 function TIBUpdateSQLDeleteProperty.GetAttributes: TPropertyAttributes;
876 tony 1 begin
877 tony 5 Result:=inherited GetAttributes;
878 tony 1 end;
879    
880 tony 5 procedure TIBUpdateSQLDeleteProperty.Edit;
881 tony 1 begin
882 tony 7 GetObjects;
883     if IBDeleteSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.DeleteSQL) then Modified;
884 tony 1 end;
885    
886 tony 5 { TUpdateSQLPropertyEditor }
887 tony 1
888 tony 5 function TUpdateSQLPropertyEditor.GetObjects: boolean;
889 tony 1 begin
890 tony 5 Result := false;
891     FIBUpdateSQL := GetComponent(0) as TIBUpdateSQL;
892     if not assigned(FIBUpdateSQL) or not assigned(FIBUpdateSQL.DataSet) then
893     Exit;
894 tony 7 FDatabase := nil;
895 tony 5 if FIBUpdateSQL.DataSet is TIBQuery then
896 tony 1 begin
897 tony 5 FDatabase := (FIBUpdateSQL.DataSet as TIBQuery).Database;
898     Result := true
899 tony 1 end;
900     end;
901    
902 tony 5 { TIBInsertSQLProperty }
903 tony 1
904 tony 5 procedure TIBInsertSQLProperty.Edit;
905     var
906     IBDataset: TIBDataset;
907 tony 1 begin
908 tony 5 IBDataset := GetComponent(0) as TIBDataset;
909 tony 7 if IBInsertSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.InsertSQL) then Modified;
910 tony 1 end;
911    
912 tony 5 { TIBUpdateSQLInsertSQLProperty }
913 tony 1
914 tony 5 procedure TIBUpdateSQLInsertSQLProperty.Edit;
915 tony 1 begin
916 tony 7 GetObjects;
917     if IBInsertSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.InsertSQL) then Modified;
918 tony 1 end;
919    
920 tony 5 { TIBGeneratorProperty }
921 tony 1
922 tony 5 function TIBGeneratorProperty.GetAttributes: TPropertyAttributes;
923 tony 1 begin
924 tony 5 Result:= inherited GetAttributes + [paDialog] - [paMultiSelect,paValueList];
925 tony 1 end;
926    
927 tony 5 procedure TIBGeneratorProperty.Edit;
928 tony 1 begin
929 tony 5 if IBGeneratorEditor.EditGenerator(GetPersistentReference as TIBGenerator) then Modified;
930 tony 1 end;
931    
932 tony 7 { TIBSQLEditor }
933    
934     procedure TIBSQLEditor.ExecuteVerb(Index: Integer);
935     begin
936     if IBSQLEditor.EditIBSQL(TIBSQL(Component)) then Modified;
937     end;
938    
939     function TIBSQLEditor.GetVerb(Index: Integer): string;
940     begin
941     case Index of
942     0 : Result := SIBSQLEditor;
943     1: Result := SInterbaseExpressVersion;
944     end;
945     end;
946    
947     function TIBSQLEditor.GetVerbCount: Integer;
948     begin
949     Result:= 2
950     end;
951    
952     { TIBSQLSQLPropertyEditor }
953    
954     procedure TIBSQLSQLPropertyEditor.Edit;
955     var
956     IBSQL: TIBSQL;
957     begin
958     IBSQL := GetComponent(0) as TIBSQL;
959     if IBSQLEditor.EditIBSQL(IBSQL) then Modified;
960     end;
961    
962 tony 5 initialization
963     {$I IBDBReg.lrs}
964 tony 1 end.