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

# Content
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 { 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 {************************************************************************}
32
33 unit IBDBReg;
34
35 {$MODE Delphi}
36
37 (*
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 uses {Windows,} SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo,
58 DB, IBTable, IBDatabase, IBEventsEditor, LazarusPackageIntf,
59 IBUpdateSQL, IBXConst, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor;
60
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 TIBQueryEditor = class(TFieldsComponentEditor)
132 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 TIBStoredProcEditor = class(TFieldsComponentEditor)
141 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 TIBDataSetEditor = class(TFieldsComponentEditor)
150 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 { 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 TIBStoredProcParamsProperty = class(TCollectionPropertyEditor)
184 public
185 procedure Edit; override;
186 end;
187 (*
188 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 *)
200 { TSQLPropertyEditor }
201
202 TSQLPropertyEditor = class(TStringsPropertyEditor)
203 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 {TIBSQLSQLPropertyEditor }
215
216 TIBSQLSQLPropertyEditor = class(TSQLPropertyEditor)
217 public
218 procedure Edit; override;
219 end;
220
221 { 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 { 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 public
248 procedure Edit; override;
249 end;
250
251 { TIBRefreshSQLProperty }
252
253 TIBRefreshSQLProperty = class(TSQLPropertyEditor)
254 public
255 procedure Edit; override;
256 end;
257
258 { TIBInsertSQLProperty }
259
260 TIBInsertSQLProperty = class(TSQLPropertyEditor)
261 public
262 procedure Edit; override;
263 end;
264
265 { TIBDeleteSQLProperty }
266
267 TIBDeleteSQLProperty = class(TSQLPropertyEditor)
268 public
269 procedure Edit; override;
270 end;
271
272 { TIBUpdateSQLUpdateProperty }
273
274 TIBUpdateSQLUpdateProperty = class(TUpdateSQLPropertyEditor)
275 public
276 procedure Edit; override;
277 end;
278
279 { TIBUpdateSQLRefreshSQLProperty }
280
281 TIBUpdateSQLRefreshSQLProperty = class(TUpdateSQLPropertyEditor)
282 public
283 procedure Edit; override;
284 end;
285
286 { TIBUpdateSQLInsertSQLProperty }
287
288 TIBUpdateSQLInsertSQLProperty = class(TUpdateSQLPropertyEditor)
289 public
290 procedure Edit; override;
291 end;
292
293 { TIBUpdateSQLDeleteProperty }
294
295 TIBUpdateSQLDeleteProperty = class(TUpdateSQLPropertyEditor)
296 public
297 function GetAttributes: TPropertyAttributes; override;
298 procedure Edit; override;
299 end;
300
301 { TIBEventListProperty }
302
303 TIBEventListProperty = class(TClassProperty)
304 public
305 function GetAttributes: TPropertyAttributes; override;
306 procedure Edit; override;
307 end;
308
309 {TIBGeneratorProperty}
310
311 TIBGeneratorProperty = class(TPersistentPropertyEditor)
312 public
313 function GetAttributes: TPropertyAttributes; override;
314 procedure Edit; override;
315 end;
316
317 procedure Register;
318
319 implementation
320
321 uses IB, IBQuery, IBStoredProc, IBCustomDataSet,
322 IBIntf, IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents,
323 IBServices, IBDatabaseEdit, IBTransactionEdit,
324 IBBatchMove, DBLoginDlg, IBExtract,LResources, IBSelectSQLEditor,
325 IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor,
326 IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor,
327 IBSQLEditor, ibserviceeditor;
328
329
330
331 procedure Register;
332 begin
333 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 RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService,
343 TIBRestoreService, TIBValidationService, TIBStatisticalService,
344 TIBLogService, TIBSecurityService, TIBServerProperties]);
345 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 // RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize}
352 RegisterPropertyEditor(TypeInfo(TStrings), TIBQuery, 'SQL', TIBQuerySQLProperty); {do not localize}
353 RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'SelectSQL', TIBDatasetSQLProperty); {do not localize}
354 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 RegisterPropertyEditor(TypeInfo(TStrings), TIBSQL, 'SQL', TIBSQLSQLPropertyEditor); {do not localize}
359 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 RegisterPropertyEditor(TypeInfo(TStrings), TIBEvents, 'Events', TIBEventListProperty); {do not localize}
364 RegisterPropertyEditor(TypeInfo(TPersistent), TIBDataSet, 'GeneratorField', TIBGeneratorProperty); {do not localize}
365 RegisterPropertyEditor(TypeInfo(TPersistent), TIBQuery, 'GeneratorField', TIBGeneratorProperty); {do not localize}
366
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 RegisterComponentEditor(TIBSQL, TIBSQLEditor);
374 RegisterComponentEditor(TIBCustomService, TIBServiceEditor);
375 end;
376
377 { 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 { TIBFileNameProperty }
410 procedure TIBFileNameProperty.Edit;
411 begin
412 with TOpenDialog.Create(Application) do
413 try
414 InitialDir := ExtractFilePath(GetStrValue);
415 Filter := SDatabaseFilter; {do not localize}
416 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 if StoredProc.Database = nil then
444 Exit;
445
446 with StoredProc do
447 try
448 for I := 0 to StoredProcedureNames.Count - 1 do
449 Proc (StoredProcedureNames[i]);
450 except on E: Exception do
451 MessageDlg(E.Message,mtError,[mbOK],0)
452 end;
453 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 Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties];
545 end;
546
547 { TIBQuerySQLProperty }
548
549 procedure TIBQuerySQLProperty.Edit;
550 var
551 Query: TIBQuery;
552 begin
553 Query := GetComponent(0) as TIBQuery;
554 if IBSelectSQLEditor.EditSQL(Query.Database,Query.SQL) then Modified;
555 end;
556
557 { TIBDatasetSQLProperty }
558
559 procedure TIBDatasetSQLProperty.Edit;
560 var
561 IBDataset: TIBDataset;
562 begin
563 IBDataset := GetComponent(0) as TIBDataset;
564 if IBSelectSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.SelectSQL) then Modified;
565 end;
566
567 { TIBSQLProperty }
568
569 procedure TIBSQLProperty.Edit;
570 var
571 IBSQL: TIBSQL;
572 begin
573 IBSQL := GetComponent(0) as TIBSQL;
574 if IBSelectSQLEditor.EditSQL(IBSQL.Database,IBSQL.SQL) then Modified;
575 end;
576
577 { TIBUpdateSQLEditor }
578
579 procedure TIBUpdateSQLEditor.ExecuteVerb(Index: Integer);
580 begin
581 if IBUpdateSQLEditor.EditIBUpdateSQL(TIBUpdateSQL(Component)) then Modified;
582 end;
583
584 function TIBUpdateSQLEditor.GetVerb(Index: Integer): string;
585 begin
586 case Index of
587 0 : Result := SIBUpdateSQLEditor;
588 1: Result := SInterbaseExpressVersion;
589 end;
590 end;
591
592 function TIBUpdateSQLEditor.GetVerbCount: Integer;
593 begin
594 Result := 2;
595 end;
596
597 { TIBDataSetEditor }
598
599 procedure TIBDataSetEditor.ExecuteVerb(Index: Integer);
600 var
601 IBDataset: TIBDataset;
602 begin
603 if Index < inherited GetVerbCount then
604 inherited ExecuteVerb(Index) else
605 begin
606 Dec(Index, inherited GetVerbCount);
607 case Index of
608 0:
609 if IBDataSetEditor.EditIBDataSet(TIBDataSet(Component)) then
610 Designer.Modified;
611 1: (Component as TIBDataSet).ExecSQL;
612 end;
613 end;
614 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 2: Result := SInterbaseExpressVersion;
626 end;
627 end;
628 end;
629
630 function TIBDataSetEditor.GetVerbCount: Integer;
631 begin
632 Result := inherited GetVerbCount + 3;
633 end;
634
635 { TIBEventListProperty }
636
637 function TIBEventListProperty.GetAttributes: TPropertyAttributes;
638 begin
639 Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties];
640 end;
641
642 procedure TIBEventListProperty.Edit;
643 var
644 Events: TStrings;
645 IBEvents: TIBEvents;
646 begin
647 IBEvents := GetComponent(0) as TIBEvents;
648 Events := TStringList.Create;
649 try
650 Events.Assign( IBEvents.Events);
651 if EditAlerterEvents( Events) then
652 begin
653 IBEvents.Events.Assign(Events);
654 Modified
655 end;
656 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 if Index < inherited GetVerbCount then
721 inherited ExecuteVerb(Index) else
722 begin
723 Query := Component as TIBQuery;
724 Dec(Index, inherited GetVerbCount);
725 case Index of
726 0: Query.ExecSQL;
727 1: if ibselectsqleditor.EditSQL(Query.Database,Query.SQL) then Designer.Modified;
728 end;
729 end;
730 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 Result := inherited GetVerbCount + 3;
749 end;
750
751 { TIBStoredProcEditor }
752
753 procedure TIBStoredProcEditor.ExecuteVerb(Index: Integer);
754 begin
755 if Index < inherited GetVerbCount then
756 inherited ExecuteVerb(Index) else
757 begin
758 Dec(Index, inherited GetVerbCount);
759 if Index = 0 then (Component as TIBStoredProc).ExecProc;
760 end;
761 end;
762
763 function TIBStoredProcEditor.GetVerb(Index: Integer): string;
764 begin
765 if Index < inherited GetVerbCount then
766 Result := inherited GetVerb(Index) else
767 begin
768 Dec(Index, inherited GetVerbCount);
769 case Index of
770 0: Result := SExecute;
771 1: Result := SInterbaseExpressVersion;
772 end;
773 end;
774 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 (*
798 { 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 end;*)
825
826 { TIBUpdateSQLProperty }
827
828 procedure TIBUpdateSQLProperty.Edit;
829 var
830 IBDataset: TIBDataset;
831 begin
832 IBDataset := GetComponent(0) as TIBDataset;
833 if IBModifySQLEditor.EditSQL(IBDataSet.Database,IBDataSet.ModifySQL) then Modified;
834 end;
835
836 { TIBUpdateSQLUpdateProperty }
837
838 procedure TIBUpdateSQLUpdateProperty.Edit;
839 begin
840 GetObjects;
841 if IBModifySQLEditor.EditSQL(FDatabase,FIBUpdateSQL.ModifySQL) then Modified;
842 end;
843
844 { TIBRefreshSQLProperty }
845
846 procedure TIBRefreshSQLProperty.Edit;
847 var
848 IBDataset: TIBDataset;
849 aDatabase: TIBDatabase;
850 begin
851 IBDataset := GetComponent(0) as TIBDataset;
852 if IBRefreshSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.RefreshSQL) then Modified;
853 end;
854
855 { TIBUpdateSQLRefreshSQLProperty }
856
857 procedure TIBUpdateSQLRefreshSQLProperty.Edit;
858 begin
859 GetObjects;
860 if IBRefreshSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.RefreshSQL) then Modified;
861 end;
862
863 { TIBDeleteSQLProperty }
864
865 procedure TIBDeleteSQLProperty.Edit;
866 var
867 IBDataset: TIBDataset;
868 begin
869 IBDataset := GetComponent(0) as TIBDataset;
870 if IBDeleteSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.DeleteSQL) then Modified;
871 end;
872
873 { TIBUpdateSQLDeleteProperty }
874
875 function TIBUpdateSQLDeleteProperty.GetAttributes: TPropertyAttributes;
876 begin
877 Result:=inherited GetAttributes;
878 end;
879
880 procedure TIBUpdateSQLDeleteProperty.Edit;
881 begin
882 GetObjects;
883 if IBDeleteSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.DeleteSQL) then Modified;
884 end;
885
886 { TUpdateSQLPropertyEditor }
887
888 function TUpdateSQLPropertyEditor.GetObjects: boolean;
889 begin
890 Result := false;
891 FIBUpdateSQL := GetComponent(0) as TIBUpdateSQL;
892 if not assigned(FIBUpdateSQL) or not assigned(FIBUpdateSQL.DataSet) then
893 Exit;
894 FDatabase := nil;
895 if FIBUpdateSQL.DataSet is TIBQuery then
896 begin
897 FDatabase := (FIBUpdateSQL.DataSet as TIBQuery).Database;
898 Result := true
899 end;
900 end;
901
902 { TIBInsertSQLProperty }
903
904 procedure TIBInsertSQLProperty.Edit;
905 var
906 IBDataset: TIBDataset;
907 begin
908 IBDataset := GetComponent(0) as TIBDataset;
909 if IBInsertSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.InsertSQL) then Modified;
910 end;
911
912 { TIBUpdateSQLInsertSQLProperty }
913
914 procedure TIBUpdateSQLInsertSQLProperty.Edit;
915 begin
916 GetObjects;
917 if IBInsertSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.InsertSQL) then Modified;
918 end;
919
920 { TIBGeneratorProperty }
921
922 function TIBGeneratorProperty.GetAttributes: TPropertyAttributes;
923 begin
924 Result:= inherited GetAttributes + [paDialog] - [paMultiSelect,paValueList];
925 end;
926
927 procedure TIBGeneratorProperty.Edit;
928 begin
929 if IBGeneratorEditor.EditGenerator(GetPersistentReference as TIBGenerator) then Modified;
930 end;
931
932 { 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 initialization
963 {$I IBDBReg.lrs}
964 end.