ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/IBDBReg.pas
Revision: 435
Committed: Mon Jun 3 13:11:42 2024 UTC (3 months, 2 weeks ago) by tony
Content type: text/x-pascal
File size: 33846 byte(s)
Log Message:
Publication of R2-7-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 - 2018 }
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 {$H+} (* Huge Strings: On *)
43 {$J-} (* Modification of Typed Constants: Off *)
44 {$M+} (* Generate run-time type information: On *)
45 {$O+} (* Optimization: On *)
46 {$Q-} (* Overflow checks: Off *)
47 {$R-} (* Range checks: Off *)
48 {$T+} (* Typed address: On *)
49 {$W-} (* Always generate stack frames: Off *)
50 {$X+} (* Extended syntax: On *)
51 {$Z1} (* Minimum Enumeration Size: 1 Byte *)
52
53 interface
54
55 uses SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo,
56 DB, IBTable, IBDatabase, IBEventsEditor, LazarusPackageIntf,
57 IBUpdateSQL, IBUpdate, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor,
58 dbFieldLinkPropEditor, IBDialogs;
59
60 type
61
62 { TIBFileNameProperty
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)
83 public
84 function GetAttributes: TPropertyAttributes; override;
85 end;
86
87 { TIBStoredProcNameProperty
88 Editor for the TIBStoredProc.StoredProcName property. Displays a drop-down list of all
89 the StoredProcedures in the Database.}
90 TIBStoredProcNameProperty = class(TIBNameProperty)
91 public
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.}
106 TIBTableNameProperty = class(TIBNameProperty)
107 public
108 procedure GetValues(Proc: TGetStrProc); override;
109 end;
110
111 { TDBStringProperty }
112
113 TDBStringProperty = class(TStringProperty)
114 private
115 function ConnecttoDB: boolean;
116 public
117 function GetAttributes: TPropertyAttributes; override;
118 procedure GetValueList(List: TStrings); virtual;
119 procedure GetValues(Proc: TGetStrProc); override;
120 procedure Edit; override;
121 end;
122
123 { TIBIndexFieldNamesProperty }
124
125 TIBIndexFieldNamesProperty = class(TDBStringProperty)
126 public
127 procedure GetValueList(List: TStrings); override;
128 end;
129
130 TIBIndexNameProperty = class(TDBStringProperty)
131 public
132 procedure GetValueList(List: TStrings); override;
133 end;
134
135 { TIBDatabaseEditor }
136
137 TIBDatabaseEditor = class(TComponentEditor)
138 procedure ExecuteVerb(Index: Integer); override;
139 function GetVerb(Index: Integer): string; override;
140 function GetVerbCount: Integer; override;
141 end;
142
143 { TIBTransactionEditor }
144
145 TIBTransactionEditor = 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)
155 public
156 procedure ExecuteVerb(Index: Integer); override;
157 function GetVerb(Index: Integer): string; override;
158 function GetVerbCount: Integer; override;
159 end;
160
161 { TIBStoredProcEditor }
162
163 TIBStoredProcEditor = class(TFieldsComponentEditor)
164 public
165 procedure ExecuteVerb(Index: Integer); override;
166 function GetVerb(Index: Integer): string; override;
167 function GetVerbCount: Integer; override;
168 end;
169
170 { TIBDataSetEditor }
171
172 TIBDataSetEditor = class(TFieldsComponentEditor)
173 public
174 procedure ExecuteVerb(Index: Integer); override;
175 function GetVerb(Index: Integer): string; override;
176 function GetVerbCount: Integer; override;
177 end;
178
179 { TIBUpdateSQLEditor }
180
181 TIBUpdateSQLEditor = class(TComponentEditor)
182 public
183 procedure ExecuteVerb(Index: Integer); override;
184 function GetVerb(Index: Integer): string; override;
185 function GetVerbCount: Integer; override;
186 end;
187
188 { TIBSQLEditor }
189
190 TIBSQLEditor = class(TComponentEditor)
191 public
192 procedure ExecuteVerb(Index: Integer); override;
193 function GetVerb(Index: Integer): string; override;
194 function GetVerbCount: Integer; override;
195 end;
196
197 { TIBServiceEditor}
198
199 TIBServiceEditor = class(TComponentEditor)
200 public
201 procedure ExecuteVerb(Index: Integer); override;
202 function GetVerb(Index: Integer): string; override;
203 function GetVerbCount: Integer; override;
204 end;
205
206 { TIBXServiceEditor }
207
208 TIBXServiceEditor = class(TComponentEditor)
209 public
210 procedure ExecuteVerb(Index: Integer); override;
211 function GetVerb(Index: Integer): string; override;
212 function GetVerbCount: Integer; override;
213 end;
214
215 TIBStoredProcParamsProperty = class(TCollectionPropertyEditor)
216 end;
217
218 { TIBTableFieldLinkProperty }
219
220 TIBTableFieldLinkProperty = class(TFieldLinkProperty)
221 private
222 FTable: TIBTable;
223 protected
224 function GetIndexDefs: TIndexDefs; override;
225 function GetIndexFieldNames: string; override;
226 function GetMasterFields: string; override;
227 procedure SetIndexFieldNames(const Value: string); override;
228 procedure SetMasterFields(const Value: string); override;
229 public
230 procedure Edit; override;
231 end;
232
233 { TSQLPropertyEditor }
234
235 TSQLPropertyEditor = class(TStringsPropertyEditor)
236 public
237 function GetAttributes: TPropertyAttributes; override;
238 end;
239
240 { TIBQuerySQLProperty }
241
242 TIBQuerySQLProperty = class(TSQLPropertyEditor)
243 public
244 procedure Edit; override;
245 end;
246
247 {TIBSQLSQLPropertyEditor }
248
249 TIBSQLSQLPropertyEditor = class(TSQLPropertyEditor)
250 public
251 procedure Edit; override;
252 end;
253
254 { TIBDatasetSQLProperty }
255
256 TIBDatasetSQLProperty = class(TSQLPropertyEditor)
257 public
258 procedure Edit; override;
259 end;
260
261 { TIBSQLProperty }
262
263 TIBSQLProperty = class(TSQLPropertyEditor)
264 public
265 procedure Edit; override;
266 end;
267
268 { TUpdateSQLPropertyEditor }
269
270 TUpdateSQLPropertyEditor = class(TSQLPropertyEditor)
271 protected
272 FIBUpdateSQL: TIBUpdateSQL;
273 FDatabase: TIBDatabase;
274 function GetObjects: boolean;
275 end;
276
277 { TIBUpdateSQLProperty }
278
279 TIBUpdateSQLProperty = class(TSQLPropertyEditor)
280 public
281 procedure Edit; override;
282 end;
283
284 { TIBRefreshSQLProperty }
285
286 TIBRefreshSQLProperty = class(TSQLPropertyEditor)
287 public
288 procedure Edit; override;
289 end;
290
291 { TIBInsertSQLProperty }
292
293 TIBInsertSQLProperty = class(TSQLPropertyEditor)
294 public
295 procedure Edit; override;
296 end;
297
298 { TIBDeleteSQLProperty }
299
300 TIBDeleteSQLProperty = class(TSQLPropertyEditor)
301 public
302 procedure Edit; override;
303 end;
304
305 { TIBUpdateSQLUpdateProperty }
306
307 TIBUpdateSQLUpdateProperty = class(TUpdateSQLPropertyEditor)
308 public
309 procedure Edit; override;
310 end;
311
312 { TIBUpdateSQLRefreshSQLProperty }
313
314 TIBUpdateSQLRefreshSQLProperty = class(TUpdateSQLPropertyEditor)
315 public
316 procedure Edit; override;
317 end;
318
319 { TIBUpdateSQLInsertSQLProperty }
320
321 TIBUpdateSQLInsertSQLProperty = class(TUpdateSQLPropertyEditor)
322 public
323 procedure Edit; override;
324 end;
325
326 { TIBUpdateSQLDeleteProperty }
327
328 TIBUpdateSQLDeleteProperty = class(TUpdateSQLPropertyEditor)
329 public
330 function GetAttributes: TPropertyAttributes; override;
331 procedure Edit; override;
332 end;
333
334 { TIBUpdateRefreshSQLProperty }
335
336 TIBUpdateRefreshSQLProperty = class(TSQLPropertyEditor)
337 protected
338 FIBUpdate: TIBUpdate;
339 FDatabase: TIBDatabase;
340 function GetObjects: boolean;
341 public
342 procedure Edit; override;
343 end;
344
345
346 { TIBEventListProperty }
347
348 TIBEventListProperty = class(TClassProperty)
349 public
350 function GetAttributes: TPropertyAttributes; override;
351 procedure Edit; override;
352 end;
353
354 {TIBGeneratorProperty}
355
356 TIBGeneratorProperty = class(TPersistentPropertyEditor)
357 public
358 function GetAttributes: TPropertyAttributes; override;
359 procedure Edit; override;
360 end;
361
362 { TIBFieldDefsProperty }
363
364 TIBFieldDefsProperty = class(TCollectionPropertyEditor)
365 public
366 procedure Edit; override;
367 end;
368
369 { TIBIndexDefsProperty }
370
371 TIBIndexDefsProperty = class(TCollectionPropertyEditor)
372 public
373 procedure Edit; override;
374 end;
375
376
377 procedure Register;
378
379 implementation
380
381 uses IB, IBQuery, IBStoredProc, IBCustomDataSet, IBMessages,
382 IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, IBInternals,
383 IBServices, IBXServices, IBDatabaseEdit, IBTransactionEdit,
384 IBBatchMove, IBExtract,LResources, IBSelectSQLEditor,
385 IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor,
386 IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor,
387 IBSQLEditor, ibserviceeditor, LCLVersion, ibxscript, IBLocalDBSupport, IBDSDialogs,
388 IBVersion, IBDataOutput, IBXServiceEditor, IBJournal;
389
390 const
391 IBPalette1 = 'Firebird'; {do not localize}
392 IBPalette2 = 'Firebird Legacy Admin'; {do not localize}
393 IBPalette3 = 'Firebird Admin'; {do not localize}
394
395 resourcestring
396 SInterbaseExpressVersion = 'Firebird Express for Lazarus ' + IBX_VERSION;
397 SEditSQL = 'Edit SQL';
398 SIBSQLEditor = 'IBSQL Editor';
399 SIBServiceEditor = 'Edit IB Service';
400 SIBUpdateSQLEditor = '&UpdateSQL Editor...';
401 SIBDataSetEditor = '&Dataset Editor...';
402 SExecute = 'E&xecute';
403 SIBDatabaseEditor = 'Da&tabase Editor...';
404 SIBTransactionEditor = '&Transaction Editor...';
405 SFBLibLoadProblem = 'IBX is unable to locate or otherwise load the Firebird Library - have you remembered to install it?';
406
407 procedure Register;
408 begin
409 AllowUseOfFBLIB := true;
410 try
411 if not TryIBLoad then
412 begin
413 MessageDlg(SFBLibLoadProblem,mtError,[mbOK],0);
414 Exit;
415 end;
416 except on E: Exception do
417 begin
418 MessageDlg(SFBLibLoadProblem + ' - ' + E.Message,mtError,[mbOK],0);
419 Exit;
420 end;
421 end;
422
423 RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField,
424 TIBSmallintField, TIBIntegerField, TIBLargeIntField, TIBDateTimeField,
425 TIBTimeField]);
426 {$if not declared(TIntegerField)}
427 {see http://bugs.freepascal.org/view.php?id=19035 }
428 RegisterNoIcon([TIntegerField]);
429 {$endif}
430 RegisterComponents(IBPalette1, [ TIBQuery, TIBDataSet,
431 TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBUpdate, TIBEvents,
432 TIBSQL, TIBDatabaseInfo, TIBSQLMonitor,
433 TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract, TIBXScript, TIBJournal, TIBLocalDBSupport,
434 TIBBlockFormatOut,TIBCSVDataOut,TIBInsertStmtsOut]);
435 if FirebirdAPI.HasServiceAPI then
436 begin
437 RegisterComponents(IBPalette3, [TIBXServicesConnection, TIBXConfigService,
438 TIBXClientSideBackupService, TIBXServerSideBackupService,
439 TIBXClientSideRestoreService, TIBXServerSideRestoreService,
440 TIBXValidationService, TIBXOnlineValidationService, TIBXStatisticalService,
441 TIBXLogService, TIBXSecurityService, TIBXServerProperties,
442 TIBXLimboTransactionResolutionService,TIBXServicesUserList, TIBXServicesLimboTransactionsList]);
443 RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService,
444 TIBRestoreService, TIBValidationService,
445 TIBOnlineValidationService, TIBStatisticalService,
446 TIBLogService, TIBSecurityService, TIBServerProperties]);
447 end;
448
449
450 RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize}
451 RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'FirebirdLibraryPathName', TIBLibraryNameProperty); {do not localize}
452 RegisterPropertyEditor(TypeInfo(TIBFileName), TIBXServicesConnection, 'FirebirdLibraryPathName', TIBLibraryNameProperty); {do not localize}
453 RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize}
454 RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'PackageName', TIBPackageNameProperty); {do not localize}
455 RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty);
456 RegisterPropertyEditor(TypeInfo(string), TIBTable, 'TableName', TIBTableNameProperty); {do not localize}
457 RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexName', TIBIndexNameProperty); {do not localize}
458 RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexFieldNames', TIBIndexFieldNamesProperty); {do not localize}
459 RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize}
460 RegisterPropertyEditor(TypeInfo(TFieldDefs), TIBTable, 'FieldDefs', TIBFieldDefsProperty); {do not localize}
461 RegisterPropertyEditor(TypeInfo(TIndexDefs), TIBTable, 'IndexDefs', TIBIndexDefsProperty); {do not localize}
462 RegisterPropertyEditor(TypeInfo(TStrings), TIBQuery, 'SQL', TIBQuerySQLProperty); {do not localize}
463 RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'SelectSQL', TIBDatasetSQLProperty); {do not localize}
464 RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'ModifySQL', TIBUpdateSQLProperty); {do not localize}
465 RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'InsertSQL', TIBInsertSQLProperty); {do not localize}
466 RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'RefreshSQL', TIBRefreshSQLProperty); {do not localize}
467 RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'DeleteSQL', TIBDeleteSQLProperty); {do not localize}
468 RegisterPropertyEditor(TypeInfo(TStrings), TIBSQL, 'SQL', TIBSQLSQLPropertyEditor); {do not localize}
469 RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'RefreshSQL', TIBUpdateSQLRefreshSQLProperty); {do not localize}
470 RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'ModifySQL', TIBUpdateSQLUpdateProperty); {do not localize}
471 RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'InsertSQL', TIBUpdateSQLInsertSQLProperty); {do not localize}
472 RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'DeleteSQL', TIBUpdateSQLDeleteProperty); {do not localize}
473 RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdate, 'RefreshSQL', TIBUpdateRefreshSQLProperty); {do not localize}
474 RegisterPropertyEditor(TypeInfo(TStrings), TIBEvents, 'Events', TIBEventListProperty); {do not localize}
475 RegisterPropertyEditor(TypeInfo(TPersistent), TIBDataSet, 'GeneratorField', TIBGeneratorProperty); {do not localize}
476 RegisterPropertyEditor(TypeInfo(TPersistent), TIBQuery, 'GeneratorField', TIBGeneratorProperty); {do not localize}
477 RegisterPropertyEditor(TypeInfo(TPersistent), TIBTable, 'GeneratorField', TIBGeneratorProperty); {do not localize}
478
479 RegisterComponentEditor(TIBDatabase, TIBDatabaseEditor);
480 RegisterComponentEditor(TIBTransaction, TIBTransactionEditor);
481 RegisterComponentEditor(TIBUpdateSQL, TIBUpdateSQLEditor);
482 RegisterComponentEditor(TIBDataSet, TIBDataSetEditor);
483 RegisterComponentEditor(TIBQuery, TIBQueryEditor);
484 RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor);
485 RegisterComponentEditor(TIBSQL, TIBSQLEditor);
486 RegisterComponentEditor(TIBCustomService, TIBServiceEditor);
487 RegisterComponentEditor(TIBXServicesConnection, TIBXServiceEditor);
488
489 IBGUIInterface := TIBDSLCLInterface.Create;
490 end;
491
492 { TIBLibraryNameProperty }
493
494 function TIBLibraryNameProperty.GetFilter: string;
495 begin
496 Result := SLibraryNameFilter; {do not localise}
497 end;
498
499 { TIBXServiceEditor }
500
501 procedure TIBXServiceEditor.ExecuteVerb(Index: Integer);
502 begin
503 if Index < inherited GetVerbCount then
504 inherited ExecuteVerb(Index) else
505 begin
506 Dec(Index, inherited GetVerbCount);
507 case Index of
508 0 : if IBXServiceEditor.EditIBXService(TIBXServicesConnection(Component)) then Designer.Modified;
509 end;
510 end;
511 end;
512
513 function TIBXServiceEditor.GetVerb(Index: Integer): string;
514 begin
515 if Index < inherited GetVerbCount then
516 Result := inherited GetVerb(Index) else
517 begin
518 Dec(Index, inherited GetVerbCount);
519 case Index of
520 0: Result := SIBServiceEditor;
521 1 : Result := SInterbaseExpressVersion;
522 end;
523 end;
524 end;
525
526 function TIBXServiceEditor.GetVerbCount: Integer;
527 begin
528 Result := inherited GetVerbCount + 2;
529 end;
530
531 { TIBUpdateRefreshSQLProperty }
532
533 function TIBUpdateRefreshSQLProperty.GetObjects: boolean;
534 begin
535 Result := false;
536 FIBUpdate := GetComponent(0) as TIBUpdate;
537 if not assigned(FIBUpdate) or not assigned(FIBUpdate.DataSet) then
538 Exit;
539 FDatabase := nil;
540 if FIBUpdate.DataSet is TIBQuery then
541 begin
542 FDatabase := (FIBUpdate.DataSet as TIBQuery).Database;
543 Result := true
544 end;
545 end;
546
547 procedure TIBUpdateRefreshSQLProperty.Edit;
548 begin
549 GetObjects;
550 if IBRefreshSQLEditor.EditSQL(FIBUpdate.DataSet,FIBUpdate.RefreshSQL) then Modified;
551 end;
552
553 { TIBPackageNameProperty }
554
555 procedure TIBPackageNameProperty.GetValues(Proc: TGetStrProc);
556 var
557 StoredProc : TIBStoredProc;
558 i : integer;
559 begin
560 StoredProc := GetComponent(0) as TIBStoredProc;
561 if StoredProc.Database = nil then
562 Exit;
563
564 with StoredProc do
565 try
566 for I := 0 to PackageNames.Count - 1 do
567 Proc (PackageNames[i]);
568 except on E: Exception do
569 MessageDlg(E.Message,mtError,[mbOK],0)
570 end;
571 end;
572
573 { TIBIndexDefsProperty }
574
575 procedure TIBIndexDefsProperty.Edit;
576 var IndexDefs: TIndexDefs;
577 begin
578 IndexDefs := TIndexDefs(GetObjectValue);
579 if IndexDefs <> nil then
580 IndexDefs.Update;
581 inherited Edit;
582 end;
583
584 { TIBFieldDefsProperty }
585
586 procedure TIBFieldDefsProperty.Edit;
587 var FieldDefs: TFieldDefs;
588 begin
589 FieldDefs := TFieldDefs(GetObjectValue);
590 if FieldDefs <> nil then
591 FieldDefs.Update;
592 inherited Edit;
593 end;
594
595 { TIBServiceEditor }
596
597 procedure TIBServiceEditor.ExecuteVerb(Index: Integer);
598 begin
599 if Index < inherited GetVerbCount then
600 inherited ExecuteVerb(Index) else
601 begin
602 Dec(Index, inherited GetVerbCount);
603 case Index of
604 0 : if ibserviceeditor.EditIBService(TIBCustomService(Component)) then Designer.Modified;
605 end;
606 end;
607 end;
608
609 function TIBServiceEditor.GetVerb(Index: Integer): string;
610 begin
611 if Index < inherited GetVerbCount then
612 Result := inherited GetVerb(Index) else
613 begin
614 Dec(Index, inherited GetVerbCount);
615 case Index of
616 0: Result := SIBServiceEditor;
617 1 : Result := SInterbaseExpressVersion;
618 end;
619 end;
620 end;
621
622 function TIBServiceEditor.GetVerbCount: Integer;
623 begin
624 Result := inherited GetVerbCount + 2;
625 end;
626
627 function TIBFileNameProperty.GetFilter: string;
628 begin
629 Result := SDatabaseFilter; {do not localize}
630 end;
631
632 { TIBFileNameProperty }
633 procedure TIBFileNameProperty.Edit;
634 begin
635 with TOpenDialog.Create(Application) do
636 try
637 InitialDir := ExtractFilePath(GetStrValue);
638 Filter := GetFilter;
639 if Execute then
640 SetStrValue(FileName);
641 finally
642 Free
643 end;
644 end;
645
646 function TIBFileNameProperty.GetAttributes: TPropertyAttributes;
647 begin
648 Result := [paDialog];
649 end;
650
651 { TIBNameProperty }
652
653 function TIBNameProperty.GetAttributes: TPropertyAttributes;
654 begin
655 Result := [paValueList, paSortList];
656 end;
657
658 { TIBStoredProcNameProperty }
659
660 procedure TIBStoredProcNameProperty.GetValues(Proc: TGetStrProc);
661 var
662 StoredProc : TIBStoredProc;
663 i : integer;
664 begin
665 StoredProc := GetComponent(0) as TIBStoredProc;
666 if StoredProc.Database = nil then
667 Exit;
668
669 with StoredProc do
670 try
671 for I := 0 to StoredProcedureNames.Count - 1 do
672 Proc (StoredProcedureNames[i]);
673 except on E: Exception do
674 MessageDlg(E.Message,mtError,[mbOK],0)
675 end;
676 end;
677
678 { TIBTableNameProperty }
679
680 procedure TIBTableNameProperty.GetValues(Proc: TGetStrProc);
681 var
682 Table : TIBTable;
683 i : integer;
684 begin
685 Table := GetComponent(0) as TIBTable;
686 if Table.Database = nil then
687 Exit;
688 with Table do
689 for I := 0 to TableNames.Count - 1 do
690 Proc (TableNames[i]);
691 end;
692
693 { TDBStringProperty }
694
695 function TDBStringProperty.ConnecttoDB: boolean;
696 var DataSet: TIBCustomDataSet;
697 begin
698 Result := false;
699 DataSet := (GetComponent(0) as TIBCustomDataSet);
700 if assigned(Dataset.Database) then
701 begin
702 try
703 DataSet.Database.Connected := true;
704 except on E: Exception do
705 ShowMessage(E.Message)
706 end;
707 Result := DataSet.Database.Connected
708 end;
709 end;
710
711 function TDBStringProperty.GetAttributes: TPropertyAttributes;
712 begin
713 Result := [paValueList, paSortList, paMultiSelect];
714 end;
715
716 procedure TDBStringProperty.GetValueList(List: TStrings);
717 begin
718 end;
719
720 procedure TDBStringProperty.GetValues(Proc: TGetStrProc);
721 var
722 I: Integer;
723 Values: TStringList;
724 begin
725 if not ConnecttoDB then Exit;
726 Values := TStringList.Create;
727 try
728 GetValueList(Values);
729 for I := 0 to Values.Count - 1 do Proc(Values[I]);
730 finally
731 Values.Free;
732 end;
733 end;
734
735 procedure TDBStringProperty.Edit;
736 begin
737 if ConnecttoDB then
738 inherited Edit;
739 end;
740
741 { Utility Functions }
742
743 function GetPropertyValue(Instance: TPersistent; const PropName: string): TPersistent;
744 var
745 PropInfo: PPropInfo;
746 begin
747 Result := nil;
748 PropInfo := TypInfo.GetPropInfo(Instance.ClassInfo, PropName);
749 if (PropInfo <> nil) and (PropInfo^.PropType^.Kind = tkClass) then
750 Result := TObject(GetOrdProp(Instance, PropInfo)) as TPersistent;
751 end;
752
753 function GetIndexDefs(Component: TPersistent): TIndexDefs;
754 var
755 DataSet: TDataSet;
756 begin
757 DataSet := Component as TDataSet;
758 Result := GetPropertyValue(DataSet, 'IndexDefs') as TIndexDefs; {do not localize}
759 if Assigned(Result) then
760 begin
761 Result.Updated := False;
762 Result.Update;
763 end;
764 end;
765
766 { TIBIndexFieldNamesProperty }
767
768 procedure TIBIndexFieldNamesProperty.GetValueList(List: TStrings);
769 var
770 I: Integer;
771 IndexDefs: TIndexDefs;
772 begin
773 IndexDefs := GetIndexDefs(GetComponent(0));
774 for I := 0 to IndexDefs.Count - 1 do
775 with IndexDefs[I] do
776 if (Options * [ixExpression, ixDescending] = []) and (Fields <> '') then
777 List.Add(Fields);
778 end;
779
780
781 { TIBIndexNameProperty }
782
783 procedure TIBIndexNameProperty.GetValueList(List: TStrings);
784 begin
785 GetIndexDefs(GetComponent(0)).GetItemNames(List);
786 end;
787
788 { TSQLPropertyEditor }
789
790 function TSQLPropertyEditor.GetAttributes: TPropertyAttributes;
791 begin
792 Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties];
793 end;
794
795 { TIBQuerySQLProperty }
796
797 procedure TIBQuerySQLProperty.Edit;
798 var
799 Query: TIBQuery;
800 begin
801 Query := GetComponent(0) as TIBQuery;
802 if IBSelectSQLEditor.EditSQL(Query,Query.SQL) then Modified;
803 end;
804
805 { TIBDatasetSQLProperty }
806
807 procedure TIBDatasetSQLProperty.Edit;
808 var
809 IBDataset: TIBDataset;
810 begin
811 IBDataset := GetComponent(0) as TIBDataset;
812 if IBSelectSQLEditor.EditSQL(IBDataSet,IBDataSet.SelectSQL) then Modified;
813 end;
814
815 { TIBSQLProperty }
816
817 procedure TIBSQLProperty.Edit;
818 var
819 IBSQL: TIBSQL;
820 begin
821 IBSQL := GetComponent(0) as TIBSQL;
822 if IBSQLEditor.EditSQL(IBSQL) then Modified;
823 end;
824
825 { TIBUpdateSQLEditor }
826
827 procedure TIBUpdateSQLEditor.ExecuteVerb(Index: Integer);
828 begin
829 if IBUpdateSQLEditor.EditIBUpdateSQL(TIBUpdateSQL(Component)) then Modified;
830 end;
831
832 function TIBUpdateSQLEditor.GetVerb(Index: Integer): string;
833 begin
834 case Index of
835 0 : Result := SIBUpdateSQLEditor;
836 1: Result := SInterbaseExpressVersion ;
837 end;
838 end;
839
840 function TIBUpdateSQLEditor.GetVerbCount: Integer;
841 begin
842 Result := 2;
843 end;
844
845 { TIBDataSetEditor }
846
847 procedure TIBDataSetEditor.ExecuteVerb(Index: Integer);
848 begin
849 if Index < inherited GetVerbCount then
850 inherited ExecuteVerb(Index) else
851 begin
852 Dec(Index, inherited GetVerbCount);
853 case Index of
854 0:
855 if IBDataSetEditor.EditIBDataSet(TIBDataSet(Component)) then
856 Designer.Modified;
857 1: (Component as TIBDataSet).ExecSQL;
858 end;
859 end;
860 end;
861
862 function TIBDataSetEditor.GetVerb(Index: Integer): string;
863 begin
864 if Index < inherited GetVerbCount then
865 Result := inherited GetVerb(Index) else
866 begin
867 Dec(Index, inherited GetVerbCount);
868 case Index of
869 0: Result := SIBDataSetEditor;
870 1: Result := SExecute;
871 2: Result := SInterbaseExpressVersion ;
872 end;
873 end;
874 end;
875
876 function TIBDataSetEditor.GetVerbCount: Integer;
877 begin
878 Result := inherited GetVerbCount + 3;
879 end;
880
881 { TIBEventListProperty }
882
883 function TIBEventListProperty.GetAttributes: TPropertyAttributes;
884 begin
885 Result := inherited GetAttributes + [paDialog] - [paMultiSelect,paSubProperties];
886 end;
887
888 procedure TIBEventListProperty.Edit;
889 var
890 Events: TStrings;
891 IBEvents: TIBEvents;
892 begin
893 IBEvents := GetComponent(0) as TIBEvents;
894 Events := TStringList.Create;
895 try
896 Events.Assign( IBEvents.Events);
897 if EditAlerterEvents( Events) then
898 begin
899 IBEvents.Events.Assign(Events);
900 Modified
901 end;
902 finally
903 Events.Free;
904 end;
905 end;
906
907 { TIBDatabaseEditor }
908 procedure TIBDatabaseEditor.ExecuteVerb(Index: Integer);
909 begin
910 if Index < inherited GetVerbCount then
911 inherited ExecuteVerb(Index) else
912 begin
913 Dec(Index, inherited GetVerbCount);
914 case Index of
915 0 : if EditIBDatabase(TIBDatabase(Component)) then Designer.Modified;
916 end;
917 end;
918 end;
919
920 function TIBDatabaseEditor.GetVerb(Index: Integer): string;
921 begin
922 if Index < inherited GetVerbCount then
923 Result := inherited GetVerb(Index) else
924 begin
925 Dec(Index, inherited GetVerbCount);
926 case Index of
927 0: Result := SIBDatabaseEditor;
928 1 : Result := SInterbaseExpressVersion ;
929 end;
930 end;
931 end;
932
933 function TIBDatabaseEditor.GetVerbCount: Integer;
934 begin
935 Result := inherited GetVerbCount + 2;
936 end;
937
938 { TIBTransactionEditor }
939
940 procedure TIBTransactionEditor.ExecuteVerb(Index: Integer);
941 begin
942 case Index of
943 0: if EditIBTransaction(TIBTransaction(Component)) then Designer.Modified;
944 end;
945 end;
946
947 function TIBTransactionEditor.GetVerb(Index: Integer): string;
948 begin
949 case Index of
950 0: Result := SIBTransactionEditor;
951 1: Result := SInterbaseExpressVersion ;
952 end;
953 end;
954
955 function TIBTransactionEditor.GetVerbCount: Integer;
956 begin
957 Result := 2;
958 end;
959
960 { TIBQueryEditor }
961
962 procedure TIBQueryEditor.ExecuteVerb(Index: Integer);
963 var
964 Query: TIBQuery;
965 begin
966 if Index < inherited GetVerbCount then
967 inherited ExecuteVerb(Index) else
968 begin
969 Query := Component as TIBQuery;
970 Dec(Index, inherited GetVerbCount);
971 case Index of
972 0: Query.ExecSQL;
973 1: if ibselectsqleditor.EditSQL(Query,Query.SQL) then Designer.Modified;
974 end;
975 end;
976 end;
977
978 function TIBQueryEditor.GetVerb(Index: Integer): string;
979 begin
980 if Index < inherited GetVerbCount then
981 Result := inherited GetVerb(Index) else
982 begin
983 Dec(Index, inherited GetVerbCount);
984 case Index of
985 0: Result := SExecute;
986 1: Result := SEditSQL;
987 2: Result := SInterbaseExpressVersion ;
988 end;
989 end;
990 end;
991
992 function TIBQueryEditor.GetVerbCount: Integer;
993 begin
994 Result := inherited GetVerbCount + 3;
995 end;
996
997 { TIBStoredProcEditor }
998
999 procedure TIBStoredProcEditor.ExecuteVerb(Index: Integer);
1000 begin
1001 if Index < inherited GetVerbCount then
1002 inherited ExecuteVerb(Index) else
1003 begin
1004 Dec(Index, inherited GetVerbCount);
1005 if Index = 0 then (Component as TIBStoredProc).ExecProc;
1006 end;
1007 end;
1008
1009 function TIBStoredProcEditor.GetVerb(Index: Integer): string;
1010 begin
1011 if Index < inherited GetVerbCount then
1012 Result := inherited GetVerb(Index) else
1013 begin
1014 Dec(Index, inherited GetVerbCount);
1015 case Index of
1016 0: Result := SExecute;
1017 1: Result := SInterbaseExpressVersion ;
1018 end;
1019 end;
1020 end;
1021
1022 function TIBStoredProcEditor.GetVerbCount: Integer;
1023 begin
1024 Result := inherited GetVerbCount + 2;
1025 end;
1026
1027 { TIBTableFieldLinkProperty }
1028
1029 procedure TIBTableFieldLinkProperty.Edit;
1030 begin
1031 FTable := DataSet as TIBTable;
1032 if assigned(FTable.Database) then
1033 FTable.Database.Connected := true;
1034 inherited Edit;
1035 end;
1036
1037 function TIBTableFieldLinkProperty.GetIndexDefs: TIndexDefs;
1038 begin
1039 Result := FTable.IndexDefs
1040 end;
1041
1042 function TIBTableFieldLinkProperty.GetIndexFieldNames: string;
1043 begin
1044 Result := FTable.IndexFieldNames;
1045 end;
1046
1047 function TIBTableFieldLinkProperty.GetMasterFields: string;
1048 begin
1049 Result := FTable.MasterFields;
1050 end;
1051
1052 procedure TIBTableFieldLinkProperty.SetIndexFieldNames(const Value: string);
1053 begin
1054 FTable.IndexFieldNames := Value;
1055 end;
1056
1057 procedure TIBTableFieldLinkProperty.SetMasterFields(const Value: string);
1058 begin
1059 FTable.MasterFields := Value;
1060 end;
1061
1062 { TIBUpdateSQLProperty }
1063
1064 procedure TIBUpdateSQLProperty.Edit;
1065 var
1066 IBDataset: TIBDataset;
1067 begin
1068 IBDataset := GetComponent(0) as TIBDataset;
1069 if IBModifySQLEditor.EditSQL(IBDataSet,IBDataSet.ModifySQL) then Modified;
1070 end;
1071
1072 { TIBUpdateSQLUpdateProperty }
1073
1074 procedure TIBUpdateSQLUpdateProperty.Edit;
1075 begin
1076 GetObjects;
1077 if IBModifySQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.ModifySQL) then Modified;
1078 end;
1079
1080 { TIBRefreshSQLProperty }
1081
1082 procedure TIBRefreshSQLProperty.Edit;
1083 var
1084 IBDataset: TIBDataset;
1085 begin
1086 IBDataset := GetComponent(0) as TIBDataset;
1087 if IBRefreshSQLEditor.EditSQL(IBDataSet,IBDataSet.RefreshSQL) then Modified;
1088 end;
1089
1090 { TIBUpdateSQLRefreshSQLProperty }
1091
1092 procedure TIBUpdateSQLRefreshSQLProperty.Edit;
1093 begin
1094 GetObjects;
1095 if IBRefreshSQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.RefreshSQL) then Modified;
1096 end;
1097
1098 { TIBDeleteSQLProperty }
1099
1100 procedure TIBDeleteSQLProperty.Edit;
1101 var
1102 IBDataset: TIBDataSet;
1103 begin
1104 IBDataset := GetComponent(0) as TIBDataSet;
1105 if IBDeleteSQLEditor.EditSQL(IBDataSet,IBDataSet.DeleteSQL) then Modified;
1106 end;
1107
1108 { TIBUpdateSQLDeleteProperty }
1109
1110 function TIBUpdateSQLDeleteProperty.GetAttributes: TPropertyAttributes;
1111 begin
1112 Result:=inherited GetAttributes;
1113 end;
1114
1115 procedure TIBUpdateSQLDeleteProperty.Edit;
1116 begin
1117 GetObjects;
1118 if IBDeleteSQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.DeleteSQL) then Modified;
1119 end;
1120
1121 { TUpdateSQLPropertyEditor }
1122
1123 function TUpdateSQLPropertyEditor.GetObjects: boolean;
1124 begin
1125 Result := false;
1126 FIBUpdateSQL := GetComponent(0) as TIBUpdateSQL;
1127 if not assigned(FIBUpdateSQL) or not assigned(FIBUpdateSQL.DataSet) then
1128 Exit;
1129 FDatabase := nil;
1130 if FIBUpdateSQL.DataSet is TIBQuery then
1131 begin
1132 FDatabase := (FIBUpdateSQL.DataSet as TIBQuery).Database;
1133 Result := true
1134 end;
1135 end;
1136
1137 { TIBInsertSQLProperty }
1138
1139 procedure TIBInsertSQLProperty.Edit;
1140 var
1141 IBDataset: TIBDataSet;
1142 begin
1143 IBDataset := GetComponent(0) as TIBDataSet;
1144 if IBInsertSQLEditor.EditSQL(IBDataSet,IBDataSet.InsertSQL) then Modified;
1145 end;
1146
1147 { TIBUpdateSQLInsertSQLProperty }
1148
1149 procedure TIBUpdateSQLInsertSQLProperty.Edit;
1150 begin
1151 GetObjects;
1152 if IBInsertSQLEditor.EditSQL(FIBUpdateSQL.Dataset,FIBUpdateSQL.InsertSQL) then Modified;
1153 end;
1154
1155 { TIBGeneratorProperty }
1156
1157 function TIBGeneratorProperty.GetAttributes: TPropertyAttributes;
1158 begin
1159 Result:= inherited GetAttributes + [paDialog] - [paMultiSelect,paValueList];
1160 end;
1161
1162 procedure TIBGeneratorProperty.Edit;
1163 begin
1164 if IBGeneratorEditor.EditGenerator(GetPersistentReference as TIBGenerator) then Modified;
1165 end;
1166
1167 { TIBSQLEditor }
1168
1169 procedure TIBSQLEditor.ExecuteVerb(Index: Integer);
1170 begin
1171 if IBSQLEditor.EditSQL(TIBSQL(Component)) then Modified;
1172 end;
1173
1174 function TIBSQLEditor.GetVerb(Index: Integer): string;
1175 begin
1176 case Index of
1177 0 : Result := SIBSQLEditor;
1178 1: Result := SInterbaseExpressVersion ;
1179 end;
1180 end;
1181
1182 function TIBSQLEditor.GetVerbCount: Integer;
1183 begin
1184 Result:= 2
1185 end;
1186
1187 { TIBSQLSQLPropertyEditor }
1188
1189 procedure TIBSQLSQLPropertyEditor.Edit;
1190 var
1191 IBSQL: TIBSQL;
1192 begin
1193 IBSQL := GetComponent(0) as TIBSQL;
1194 if IBSQLEditor.EditSQL(IBSQL) then Modified;
1195 end;
1196
1197 initialization
1198 {$I IBDBReg.lrs}
1199 end.

Properties

Name Value
svn:eol-style native