39 |
|
*) |
40 |
|
{$A+} (* Aligned records: On *) |
41 |
|
{$B-} (* Short circuit boolean expressions: Off *) |
42 |
– |
{$G+} (* Imported data: On *) |
42 |
|
{$H+} (* Huge Strings: On *) |
43 |
|
{$J-} (* Modification of Typed Constants: Off *) |
44 |
|
{$M+} (* Generate run-time type information: On *) |
46 |
|
{$Q-} (* Overflow checks: Off *) |
47 |
|
{$R-} (* Range checks: Off *) |
48 |
|
{$T+} (* Typed address: On *) |
50 |
– |
{$U+} (* Pentim-safe FDIVs: On *) |
49 |
|
{$W-} (* Always generate stack frames: Off *) |
50 |
|
{$X+} (* Extended syntax: On *) |
51 |
|
{$Z1} (* Minimum Enumeration Size: 1 Byte *) |
52 |
|
|
53 |
|
interface |
54 |
|
|
55 |
< |
uses {Windows,} SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo, |
55 |
> |
uses SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo, |
56 |
|
DB, IBTable, IBDatabase, IBEventsEditor, LazarusPackageIntf, |
57 |
< |
IBUpdateSQL, IBXConst, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor; |
57 |
> |
IBUpdateSQL, IBUpdate, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor, |
58 |
> |
dbFieldLinkPropEditor, dbFieldListPropEditor, IBDialogs; |
59 |
|
|
60 |
|
type |
61 |
|
|
83 |
|
procedure GetValues(Proc: TGetStrProc); override; |
84 |
|
end; |
85 |
|
|
86 |
+ |
{ TIBPackageNameProperty |
87 |
+ |
Editor for the TIBStoredProc.PackageName property. Displays a drop-down list of all |
88 |
+ |
the StoredProcedures in the Database.} |
89 |
+ |
TIBPackageNameProperty = class(TIBNameProperty) |
90 |
+ |
public |
91 |
+ |
procedure GetValues(Proc: TGetStrProc); override; |
92 |
+ |
end; |
93 |
+ |
|
94 |
|
{ TIBTableNameProperty |
95 |
|
Editor for the TIBTable.TableName property. Displays a drop-down list of all |
96 |
|
the Tables in the Database.} |
99 |
|
procedure GetValues(Proc: TGetStrProc); override; |
100 |
|
end; |
101 |
|
|
102 |
+ |
{ TDBStringProperty } |
103 |
+ |
|
104 |
|
TDBStringProperty = class(TStringProperty) |
105 |
+ |
private |
106 |
+ |
function ConnecttoDB: boolean; |
107 |
|
public |
108 |
|
function GetAttributes: TPropertyAttributes; override; |
109 |
|
procedure GetValueList(List: TStrings); virtual; |
110 |
|
procedure GetValues(Proc: TGetStrProc); override; |
111 |
+ |
procedure Edit; override; |
112 |
|
end; |
113 |
|
|
114 |
+ |
{ TIBIndexFieldNamesProperty } |
115 |
+ |
|
116 |
|
TIBIndexFieldNamesProperty = class(TDBStringProperty) |
117 |
|
public |
118 |
|
procedure GetValueList(List: TStrings); override; |
140 |
|
function GetVerbCount: Integer; override; |
141 |
|
end; |
142 |
|
|
143 |
+ |
{ TIBArrayGridEditor } |
144 |
+ |
|
145 |
+ |
TIBArrayGridEditor = class(TComponentEditor) |
146 |
+ |
public |
147 |
+ |
procedure ExecuteVerb(Index: Integer); override; |
148 |
+ |
function GetVerb(Index: Integer): string; override; |
149 |
+ |
function GetVerbCount: Integer; override; |
150 |
+ |
end; |
151 |
+ |
|
152 |
|
{ TIBQueryEditor } |
153 |
|
|
154 |
|
TIBQueryEditor = class(TFieldsComponentEditor) |
204 |
|
end; |
205 |
|
|
206 |
|
TIBStoredProcParamsProperty = class(TCollectionPropertyEditor) |
184 |
– |
public |
185 |
– |
procedure Edit; override; |
207 |
|
end; |
208 |
< |
(* |
208 |
> |
|
209 |
> |
{ TIBTableFieldLinkProperty } |
210 |
> |
|
211 |
|
TIBTableFieldLinkProperty = class(TFieldLinkProperty) |
212 |
|
private |
213 |
|
FTable: TIBTable; |
214 |
|
protected |
215 |
+ |
function GetIndexDefs: TIndexDefs; override; |
216 |
|
function GetIndexFieldNames: string; override; |
217 |
|
function GetMasterFields: string; override; |
218 |
|
procedure SetIndexFieldNames(const Value: string); override; |
220 |
|
public |
221 |
|
procedure Edit; override; |
222 |
|
end; |
223 |
< |
*) |
223 |
> |
|
224 |
|
{ TSQLPropertyEditor } |
225 |
|
|
226 |
|
TSQLPropertyEditor = class(TStringsPropertyEditor) |
322 |
|
procedure Edit; override; |
323 |
|
end; |
324 |
|
|
325 |
+ |
{ TIBUpdateRefreshSQLProperty } |
326 |
+ |
|
327 |
+ |
TIBUpdateRefreshSQLProperty = class(TSQLPropertyEditor) |
328 |
+ |
protected |
329 |
+ |
FIBUpdate: TIBUpdate; |
330 |
+ |
FDatabase: TIBDatabase; |
331 |
+ |
function GetObjects: boolean; |
332 |
+ |
public |
333 |
+ |
procedure Edit; override; |
334 |
+ |
end; |
335 |
+ |
|
336 |
+ |
|
337 |
|
{ TIBEventListProperty } |
338 |
|
|
339 |
|
TIBEventListProperty = class(TClassProperty) |
350 |
|
procedure Edit; override; |
351 |
|
end; |
352 |
|
|
353 |
+ |
{ TDBDynamicGridFieldProperty } |
354 |
+ |
|
355 |
+ |
TDBDynamicGridFieldProperty = class(TFieldProperty) |
356 |
+ |
public |
357 |
+ |
procedure FillValues(const Values: TStringList); override; |
358 |
+ |
end; |
359 |
+ |
|
360 |
+ |
{ TDBLookupPropertiesGridFieldProperty } |
361 |
+ |
|
362 |
+ |
TDBLookupPropertiesGridFieldProperty = class(TFieldProperty) |
363 |
+ |
public |
364 |
+ |
procedure FillValues(const Values: TStringList); override; |
365 |
+ |
end; |
366 |
+ |
|
367 |
+ |
{ TIBTreeViewFieldProperty } |
368 |
+ |
|
369 |
+ |
TIBTreeViewFieldProperty = class(TFieldProperty) |
370 |
+ |
public |
371 |
+ |
procedure FillValues(const Values: TStringList); override; |
372 |
+ |
end; |
373 |
+ |
|
374 |
+ |
{ TIBDynamicGridIndexNamesProperty } |
375 |
+ |
|
376 |
+ |
TIBDynamicGridIndexNamesProperty = class(TIndexFieldNamesProperty) |
377 |
+ |
protected |
378 |
+ |
function GetFieldDefs: TFieldDefs; override; |
379 |
+ |
function GetIndexFieldNames: string; override; |
380 |
+ |
procedure SetIndexFieldNames(const Value: string); override; |
381 |
+ |
end; |
382 |
+ |
|
383 |
+ |
{ TIBFieldDefsProperty } |
384 |
+ |
|
385 |
+ |
TIBFieldDefsProperty = class(TCollectionPropertyEditor) |
386 |
+ |
public |
387 |
+ |
procedure Edit; override; |
388 |
+ |
end; |
389 |
+ |
|
390 |
+ |
{ TIBIndexDefsProperty } |
391 |
+ |
|
392 |
+ |
TIBIndexDefsProperty = class(TCollectionPropertyEditor) |
393 |
+ |
public |
394 |
+ |
procedure Edit; override; |
395 |
+ |
end; |
396 |
+ |
|
397 |
+ |
|
398 |
|
procedure Register; |
399 |
|
|
400 |
|
implementation |
401 |
|
|
402 |
< |
uses IB, IBQuery, IBStoredProc, IBCustomDataSet, |
403 |
< |
IBIntf, IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, |
402 |
> |
uses IB, IBQuery, IBStoredProc, IBCustomDataSet, FBMessages, |
403 |
> |
IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, IBTypes, |
404 |
|
IBServices, IBDatabaseEdit, IBTransactionEdit, |
405 |
< |
IBBatchMove, DBLoginDlg, IBExtract,LResources, IBSelectSQLEditor, |
405 |
> |
IBBatchMove, IBExtract,LResources, IBSelectSQLEditor, |
406 |
|
IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor, |
407 |
|
IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor, |
408 |
< |
IBSQLEditor, ibserviceeditor, LCLVersion; |
409 |
< |
|
410 |
< |
|
408 |
> |
IBSQLEditor, ibserviceeditor, LCLVersion, IBDynamicGrid, IBLookupComboEditBox, |
409 |
> |
IBTreeView, DBControlGrid, ibxscript, IBLocalDBSupport, IBDSDialogs, |
410 |
> |
IBArrayGrid, IBVersion, IBDataOutput; |
411 |
> |
|
412 |
> |
const |
413 |
> |
IBPalette1 = 'Firebird'; {do not localize} |
414 |
> |
IBPalette2 = 'Firebird Admin'; {do not localize} |
415 |
> |
IBPalette3 = 'Firebird Data Controls'; {do not localize} |
416 |
> |
|
417 |
> |
resourcestring |
418 |
> |
SInterbaseExpressVersion = 'Firebird Express for Lazarus ' + IBX_VERSION; |
419 |
> |
SEditSQL = 'Edit SQL'; |
420 |
> |
SIBSQLEditor = 'IBSQL Editor'; |
421 |
> |
SIBServiceEditor = 'Edit IB Service'; |
422 |
> |
SIBUpdateSQLEditor = '&UpdateSQL Editor...'; |
423 |
> |
SIBDataSetEditor = '&Dataset Editor...'; |
424 |
> |
SExecute = 'E&xecute'; |
425 |
> |
SIBDatabaseEditor = 'Da&tabase Editor...'; |
426 |
> |
SIBTransactionEditor = '&Transaction Editor...'; |
427 |
> |
SIBUpdateLayout = 'Update Layout'; |
428 |
|
|
429 |
|
procedure Register; |
430 |
|
begin |
434 |
|
Exit; |
435 |
|
end; |
436 |
|
|
437 |
< |
RegisterNoIcon([TIBStringField, TIBBCDField]); |
437 |
> |
RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField, |
438 |
> |
TIBSmallintField, TIBIntegerField, TIBLargeIntField]); |
439 |
|
{$if lcl_fullversion < 01010000} |
440 |
|
{see http://bugs.freepascal.org/view.php?id=19035 } |
441 |
|
RegisterNoIcon([TIntegerField]); |
442 |
|
{$endif} |
443 |
|
RegisterComponents(IBPalette1, [ TIBQuery, TIBDataSet, |
444 |
< |
TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBEvents, |
444 |
> |
TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBUpdate, TIBEvents, |
445 |
|
TIBSQL, TIBDatabaseInfo, TIBSQLMonitor, |
446 |
< |
TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract]); |
447 |
< |
if IBServiceAPIPresent then |
446 |
> |
TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract, TIBXScript, TIBLocalDBSupport, |
447 |
> |
TIBBlockFormatOut,TIBCSVDataOut,TIBInsertStmtsOut]); |
448 |
> |
if FirebirdAPI.HasServiceAPI then |
449 |
|
RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService, |
450 |
|
TIBRestoreService, TIBValidationService, TIBStatisticalService, |
451 |
|
TIBLogService, TIBSecurityService, TIBServerProperties]); |
452 |
+ |
|
453 |
+ |
|
454 |
+ |
RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid, TIBArrayGrid]); |
455 |
|
RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize} |
456 |
|
RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize} |
457 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'PackageName', TIBPackageNameProperty); {do not localize} |
458 |
|
RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty); |
459 |
|
RegisterPropertyEditor(TypeInfo(string), TIBTable, 'TableName', TIBTableNameProperty); {do not localize} |
460 |
|
RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexName', TIBIndexNameProperty); {do not localize} |
461 |
|
RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexFieldNames', TIBIndexFieldNamesProperty); {do not localize} |
462 |
< |
// RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize} |
462 |
> |
RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize} |
463 |
> |
RegisterPropertyEditor(TypeInfo(TFieldDefs), TIBTable, 'FieldDefs', TIBFieldDefsProperty); {do not localize} |
464 |
> |
RegisterPropertyEditor(TypeInfo(TIndexDefs), TIBTable, 'IndexDefs', TIBIndexDefsProperty); {do not localize} |
465 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBQuery, 'SQL', TIBQuerySQLProperty); {do not localize} |
466 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'SelectSQL', TIBDatasetSQLProperty); {do not localize} |
467 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'ModifySQL', TIBUpdateSQLProperty); {do not localize} |
473 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'ModifySQL', TIBUpdateSQLUpdateProperty); {do not localize} |
474 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'InsertSQL', TIBUpdateSQLInsertSQLProperty); {do not localize} |
475 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdateSQL, 'DeleteSQL', TIBUpdateSQLDeleteProperty); {do not localize} |
476 |
+ |
RegisterPropertyEditor(TypeInfo(TStrings), TIBUpdate, 'RefreshSQL', TIBUpdateRefreshSQLProperty); {do not localize} |
477 |
|
RegisterPropertyEditor(TypeInfo(TStrings), TIBEvents, 'Events', TIBEventListProperty); {do not localize} |
478 |
|
RegisterPropertyEditor(TypeInfo(TPersistent), TIBDataSet, 'GeneratorField', TIBGeneratorProperty); {do not localize} |
479 |
|
RegisterPropertyEditor(TypeInfo(TPersistent), TIBQuery, 'GeneratorField', TIBGeneratorProperty); {do not localize} |
480 |
+ |
RegisterPropertyEditor(TypeInfo(TPersistent), TIBTable, 'GeneratorField', TIBGeneratorProperty); {do not localize} |
481 |
|
|
482 |
|
RegisterComponentEditor(TIBDatabase, TIBDatabaseEditor); |
483 |
|
RegisterComponentEditor(TIBTransaction, TIBTransactionEditor); |
487 |
|
RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor); |
488 |
|
RegisterComponentEditor(TIBSQL, TIBSQLEditor); |
489 |
|
RegisterComponentEditor(TIBCustomService, TIBServiceEditor); |
490 |
+ |
RegisterComponentEditor(TIBArrayGrid, TIBArrayGridEditor); |
491 |
+ |
|
492 |
+ |
|
493 |
+ |
{Firebird Data Access Controls} |
494 |
+ |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'KeyField', TDBDynamicGridFieldProperty); |
495 |
+ |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'ListField', TDBDynamicGridFieldProperty); |
496 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBDynamicGrid, 'IndexFieldNames', TIBDynamicGridIndexNamesProperty); |
497 |
+ |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'DataFieldName', TDBLookupPropertiesGridFieldProperty); |
498 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'KeyField', TIBTreeViewFieldProperty); |
499 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'TextField', TIBTreeViewFieldProperty); |
500 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ParentField', TIBTreeViewFieldProperty); |
501 |
+ |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'HasChildField', TIBTreeViewFieldProperty); |
502 |
+ |
|
503 |
+ |
IBGUIInterface := TIBDSLCLInterface.Create; |
504 |
+ |
end; |
505 |
+ |
|
506 |
+ |
procedure LoadDataSourceFields(DataSource: TDataSource; List: TStrings); |
507 |
+ |
var |
508 |
+ |
DataSet: TDataSet; |
509 |
+ |
i: Integer; |
510 |
+ |
begin |
511 |
+ |
if Assigned(DataSource) then |
512 |
+ |
begin |
513 |
+ |
DataSet := DataSource.DataSet; |
514 |
+ |
if Assigned(DataSet) then |
515 |
+ |
begin |
516 |
+ |
if DataSet.Fields.Count > 0 then |
517 |
+ |
DataSet.GetFieldNames(List) |
518 |
+ |
else |
519 |
+ |
begin |
520 |
+ |
DataSet.FieldDefs.Update; |
521 |
+ |
for i := 0 to DataSet.FieldDefs.Count - 1 do |
522 |
+ |
List.Add(DataSet.FieldDefs[i].Name); |
523 |
+ |
end; |
524 |
+ |
end; |
525 |
+ |
end; |
526 |
+ |
end; |
527 |
+ |
|
528 |
+ |
{ TIBUpdateRefreshSQLProperty } |
529 |
+ |
|
530 |
+ |
function TIBUpdateRefreshSQLProperty.GetObjects: boolean; |
531 |
+ |
begin |
532 |
+ |
Result := false; |
533 |
+ |
FIBUpdate := GetComponent(0) as TIBUpdate; |
534 |
+ |
if not assigned(FIBUpdate) or not assigned(FIBUpdate.DataSet) then |
535 |
+ |
Exit; |
536 |
+ |
FDatabase := nil; |
537 |
+ |
if FIBUpdate.DataSet is TIBQuery then |
538 |
+ |
begin |
539 |
+ |
FDatabase := (FIBUpdate.DataSet as TIBQuery).Database; |
540 |
+ |
Result := true |
541 |
+ |
end; |
542 |
+ |
end; |
543 |
+ |
|
544 |
+ |
procedure TIBUpdateRefreshSQLProperty.Edit; |
545 |
+ |
begin |
546 |
+ |
GetObjects; |
547 |
+ |
if IBRefreshSQLEditor.EditSQL(FIBUpdate.DataSet,FIBUpdate.RefreshSQL) then Modified; |
548 |
+ |
end; |
549 |
+ |
|
550 |
+ |
{ TIBPackageNameProperty } |
551 |
+ |
|
552 |
+ |
procedure TIBPackageNameProperty.GetValues(Proc: TGetStrProc); |
553 |
+ |
var |
554 |
+ |
StoredProc : TIBStoredProc; |
555 |
+ |
i : integer; |
556 |
+ |
begin |
557 |
+ |
StoredProc := GetComponent(0) as TIBStoredProc; |
558 |
+ |
if StoredProc.Database = nil then |
559 |
+ |
Exit; |
560 |
+ |
|
561 |
+ |
with StoredProc do |
562 |
+ |
try |
563 |
+ |
for I := 0 to PackageNames.Count - 1 do |
564 |
+ |
Proc (PackageNames[i]); |
565 |
+ |
except on E: Exception do |
566 |
+ |
MessageDlg(E.Message,mtError,[mbOK],0) |
567 |
+ |
end; |
568 |
+ |
end; |
569 |
+ |
|
570 |
+ |
{ TIBIndexDefsProperty } |
571 |
+ |
|
572 |
+ |
procedure TIBIndexDefsProperty.Edit; |
573 |
+ |
var IndexDefs: TIndexDefs; |
574 |
+ |
begin |
575 |
+ |
IndexDefs := TIndexDefs(GetObjectValue); |
576 |
+ |
if IndexDefs <> nil then |
577 |
+ |
IndexDefs.Update; |
578 |
+ |
inherited Edit; |
579 |
+ |
end; |
580 |
+ |
|
581 |
+ |
{ TIBFieldDefsProperty } |
582 |
+ |
|
583 |
+ |
procedure TIBFieldDefsProperty.Edit; |
584 |
+ |
var FieldDefs: TFieldDefs; |
585 |
+ |
begin |
586 |
+ |
FieldDefs := TFieldDefs(GetObjectValue); |
587 |
+ |
if FieldDefs <> nil then |
588 |
+ |
FieldDefs.Update; |
589 |
+ |
inherited Edit; |
590 |
+ |
end; |
591 |
+ |
|
592 |
+ |
{ TIBArrayGridEditor } |
593 |
+ |
|
594 |
+ |
procedure TIBArrayGridEditor.ExecuteVerb(Index: Integer); |
595 |
+ |
begin |
596 |
+ |
if Index < inherited GetVerbCount then |
597 |
+ |
inherited ExecuteVerb(Index) |
598 |
+ |
else |
599 |
+ |
case Index of |
600 |
+ |
0: TIBArrayGrid(Component).UpdateLayout; |
601 |
+ |
end; |
602 |
+ |
end; |
603 |
+ |
|
604 |
+ |
function TIBArrayGridEditor.GetVerb(Index: Integer): string; |
605 |
+ |
begin |
606 |
+ |
if Index < inherited GetVerbCount then |
607 |
+ |
Result := inherited GetVerb(Index) else |
608 |
+ |
begin |
609 |
+ |
Dec(Index, inherited GetVerbCount); |
610 |
+ |
case Index of |
611 |
+ |
0: Result := SIBUpdateLayout; |
612 |
+ |
1 : Result := SInterbaseExpressVersion ; |
613 |
+ |
end; |
614 |
+ |
end; |
615 |
+ |
end; |
616 |
+ |
|
617 |
+ |
function TIBArrayGridEditor.GetVerbCount: Integer; |
618 |
+ |
begin |
619 |
+ |
Result := 2; |
620 |
+ |
end; |
621 |
+ |
|
622 |
+ |
{ TDBLookupPropertiesGridFieldProperty } |
623 |
+ |
|
624 |
+ |
procedure TDBLookupPropertiesGridFieldProperty.FillValues( |
625 |
+ |
const Values: TStringList); |
626 |
+ |
var |
627 |
+ |
P: TDBLookupProperties; |
628 |
+ |
begin |
629 |
+ |
P :=TDBLookupProperties(GetComponent(0)); |
630 |
+ |
if not (P is TDBLookupProperties) then exit; |
631 |
+ |
LoadDataSourceFields(TIBDynamicGrid(P.Owner.Grid).DataSource, Values); |
632 |
+ |
end; |
633 |
+ |
|
634 |
+ |
{ TIBTreeViewFieldProperty } |
635 |
+ |
|
636 |
+ |
procedure TIBTreeViewFieldProperty.FillValues(const Values: TStringList); |
637 |
+ |
var ListSource: TDataSource; |
638 |
+ |
begin |
639 |
+ |
ListSource := TIBTreeView(GetComponent(0)).DataSource; |
640 |
+ |
LoadDataSourceFields(ListSource, Values); |
641 |
+ |
end; |
642 |
+ |
|
643 |
+ |
{ TIBDynamicGridIndexNamesProperty } |
644 |
+ |
|
645 |
+ |
function TIBDynamicGridIndexNamesProperty.GetFieldDefs: TFieldDefs; |
646 |
+ |
var Grid: TIBDynamicGrid; |
647 |
+ |
begin |
648 |
+ |
Result := nil; |
649 |
+ |
Grid := TIBDynamicGrid(GetComponent(0)); |
650 |
+ |
if assigned(Grid.DataSource) and assigned(Grid.DataSource.DataSet) then |
651 |
+ |
Result := Grid.DataSource.DataSet.FieldDefs |
652 |
+ |
end; |
653 |
+ |
|
654 |
+ |
function TIBDynamicGridIndexNamesProperty.GetIndexFieldNames: string; |
655 |
+ |
var Grid: TIBDynamicGrid; |
656 |
+ |
begin |
657 |
+ |
Grid := TIBDynamicGrid(GetComponent(0)); |
658 |
+ |
Result := Grid.IndexFieldNames |
659 |
+ |
end; |
660 |
+ |
|
661 |
+ |
procedure TIBDynamicGridIndexNamesProperty.SetIndexFieldNames( |
662 |
+ |
const Value: string); |
663 |
+ |
var Grid: TIBDynamicGrid; |
664 |
+ |
begin |
665 |
+ |
Grid := TIBDynamicGrid(GetComponent(0)); |
666 |
+ |
Grid.IndexFieldNames := Value |
667 |
+ |
end; |
668 |
+ |
|
669 |
+ |
{ TDBDynamicGridFieldProperty } |
670 |
+ |
|
671 |
+ |
procedure TDBDynamicGridFieldProperty.FillValues(const Values: TStringList); |
672 |
+ |
var |
673 |
+ |
P: TDBLookupProperties; |
674 |
+ |
begin |
675 |
+ |
P :=TDBLookupProperties(GetComponent(0)); |
676 |
+ |
if not (P is TDBLookupProperties) then exit; |
677 |
+ |
LoadDataSourceFields(P.ListSource, Values); |
678 |
|
end; |
679 |
|
|
680 |
|
{ TIBServiceEditor } |
759 |
|
|
760 |
|
procedure TIBTableNameProperty.GetValues(Proc: TGetStrProc); |
761 |
|
var |
762 |
< |
TableName : TIBTable; |
762 |
> |
Table : TIBTable; |
763 |
|
i : integer; |
764 |
|
begin |
765 |
< |
TableName := GetComponent(0) as TIBTable; |
766 |
< |
with TableName do |
765 |
> |
Table := GetComponent(0) as TIBTable; |
766 |
> |
if Table.Database = nil then |
767 |
> |
Exit; |
768 |
> |
with Table do |
769 |
|
for I := 0 to TableNames.Count - 1 do |
770 |
|
Proc (TableNames[i]); |
771 |
|
end; |
772 |
|
|
773 |
|
{ TDBStringProperty } |
774 |
|
|
775 |
+ |
function TDBStringProperty.ConnecttoDB: boolean; |
776 |
+ |
var DataSet: TIBCustomDataSet; |
777 |
+ |
begin |
778 |
+ |
Result := false; |
779 |
+ |
DataSet := (GetComponent(0) as TIBCustomDataSet); |
780 |
+ |
if assigned(Dataset.Database) then |
781 |
+ |
begin |
782 |
+ |
try |
783 |
+ |
DataSet.Database.Connected := true; |
784 |
+ |
except on E: Exception do |
785 |
+ |
ShowMessage(E.Message) |
786 |
+ |
end; |
787 |
+ |
Result := DataSet.Database.Connected |
788 |
+ |
end; |
789 |
+ |
end; |
790 |
+ |
|
791 |
|
function TDBStringProperty.GetAttributes: TPropertyAttributes; |
792 |
|
begin |
793 |
|
Result := [paValueList, paSortList, paMultiSelect]; |
802 |
|
I: Integer; |
803 |
|
Values: TStringList; |
804 |
|
begin |
805 |
+ |
if not ConnecttoDB then Exit; |
806 |
|
Values := TStringList.Create; |
807 |
|
try |
808 |
|
GetValueList(Values); |
812 |
|
end; |
813 |
|
end; |
814 |
|
|
815 |
+ |
procedure TDBStringProperty.Edit; |
816 |
+ |
begin |
817 |
+ |
if ConnecttoDB then |
818 |
+ |
inherited Edit; |
819 |
+ |
end; |
820 |
+ |
|
821 |
|
{ Utility Functions } |
822 |
|
|
823 |
|
function GetPropertyValue(Instance: TPersistent; const PropName: string): TPersistent; |
879 |
|
Query: TIBQuery; |
880 |
|
begin |
881 |
|
Query := GetComponent(0) as TIBQuery; |
882 |
< |
if IBSelectSQLEditor.EditSQL(Query.Database,Query.SQL) then Modified; |
882 |
> |
if IBSelectSQLEditor.EditSQL(Query,Query.SQL) then Modified; |
883 |
|
end; |
884 |
|
|
885 |
|
{ TIBDatasetSQLProperty } |
889 |
|
IBDataset: TIBDataset; |
890 |
|
begin |
891 |
|
IBDataset := GetComponent(0) as TIBDataset; |
892 |
< |
if IBSelectSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.SelectSQL) then Modified; |
892 |
> |
if IBSelectSQLEditor.EditSQL(IBDataSet,IBDataSet.SelectSQL) then Modified; |
893 |
|
end; |
894 |
|
|
895 |
|
{ TIBSQLProperty } |
899 |
|
IBSQL: TIBSQL; |
900 |
|
begin |
901 |
|
IBSQL := GetComponent(0) as TIBSQL; |
902 |
< |
if IBSelectSQLEditor.EditSQL(IBSQL.Database,IBSQL.SQL) then Modified; |
902 |
> |
if IBSQLEditor.EditSQL(IBSQL) then Modified; |
903 |
|
end; |
904 |
|
|
905 |
|
{ TIBUpdateSQLEditor } |
913 |
|
begin |
914 |
|
case Index of |
915 |
|
0 : Result := SIBUpdateSQLEditor; |
916 |
< |
1: Result := SInterbaseExpressVersion; |
916 |
> |
1: Result := SInterbaseExpressVersion ; |
917 |
|
end; |
918 |
|
end; |
919 |
|
|
925 |
|
{ TIBDataSetEditor } |
926 |
|
|
927 |
|
procedure TIBDataSetEditor.ExecuteVerb(Index: Integer); |
607 |
– |
var |
608 |
– |
IBDataset: TIBDataset; |
928 |
|
begin |
929 |
|
if Index < inherited GetVerbCount then |
930 |
|
inherited ExecuteVerb(Index) else |
948 |
|
case Index of |
949 |
|
0: Result := SIBDataSetEditor; |
950 |
|
1: Result := SExecute; |
951 |
< |
2: Result := SInterbaseExpressVersion; |
951 |
> |
2: Result := SInterbaseExpressVersion ; |
952 |
|
end; |
953 |
|
end; |
954 |
|
end; |
1005 |
|
Dec(Index, inherited GetVerbCount); |
1006 |
|
case Index of |
1007 |
|
0: Result := SIBDatabaseEditor; |
1008 |
< |
1 : Result := SInterbaseExpressVersion; |
1008 |
> |
1 : Result := SInterbaseExpressVersion ; |
1009 |
|
end; |
1010 |
|
end; |
1011 |
|
end; |
1028 |
|
begin |
1029 |
|
case Index of |
1030 |
|
0: Result := SIBTransactionEditor; |
1031 |
< |
1: Result := SInterbaseExpressVersion; |
1031 |
> |
1: Result := SInterbaseExpressVersion ; |
1032 |
|
end; |
1033 |
|
end; |
1034 |
|
|
1050 |
|
Dec(Index, inherited GetVerbCount); |
1051 |
|
case Index of |
1052 |
|
0: Query.ExecSQL; |
1053 |
< |
1: if ibselectsqleditor.EditSQL(Query.Database,Query.SQL) then Designer.Modified; |
1053 |
> |
1: if ibselectsqleditor.EditSQL(Query,Query.SQL) then Designer.Modified; |
1054 |
|
end; |
1055 |
|
end; |
1056 |
|
end; |
1064 |
|
case Index of |
1065 |
|
0: Result := SExecute; |
1066 |
|
1: Result := SEditSQL; |
1067 |
< |
2: Result := SInterbaseExpressVersion; |
1067 |
> |
2: Result := SInterbaseExpressVersion ; |
1068 |
|
end; |
1069 |
|
end; |
1070 |
|
end; |
1094 |
|
Dec(Index, inherited GetVerbCount); |
1095 |
|
case Index of |
1096 |
|
0: Result := SExecute; |
1097 |
< |
1: Result := SInterbaseExpressVersion; |
1097 |
> |
1: Result := SInterbaseExpressVersion ; |
1098 |
|
end; |
1099 |
|
end; |
1100 |
|
end; |
1104 |
|
Result := inherited GetVerbCount + 2; |
1105 |
|
end; |
1106 |
|
|
788 |
– |
{ TIBStoredProcParamsProperty } |
789 |
– |
|
790 |
– |
procedure TIBStoredProcParamsProperty.Edit; |
791 |
– |
var |
792 |
– |
StoredProc: TIBStoredProc; |
793 |
– |
Params: TParams; |
794 |
– |
begin |
795 |
– |
StoredProc := (GetComponent(0) as TIBStoredProc); |
796 |
– |
Params := TParams.Create(nil); |
797 |
– |
try |
798 |
– |
StoredProc.CopyParams(Params); |
799 |
– |
finally |
800 |
– |
Params.Free; |
801 |
– |
end; |
802 |
– |
inherited Edit; |
803 |
– |
end; |
804 |
– |
(* |
1107 |
|
{ TIBTableFieldLinkProperty } |
1108 |
|
|
1109 |
|
procedure TIBTableFieldLinkProperty.Edit; |
1110 |
|
begin |
1111 |
|
FTable := DataSet as TIBTable; |
1112 |
+ |
if assigned(FTable.Database) then |
1113 |
+ |
FTable.Database.Connected := true; |
1114 |
|
inherited Edit; |
1115 |
|
end; |
1116 |
|
|
1117 |
+ |
function TIBTableFieldLinkProperty.GetIndexDefs: TIndexDefs; |
1118 |
+ |
begin |
1119 |
+ |
Result := FTable.IndexDefs |
1120 |
+ |
end; |
1121 |
+ |
|
1122 |
|
function TIBTableFieldLinkProperty.GetIndexFieldNames: string; |
1123 |
|
begin |
1124 |
|
Result := FTable.IndexFieldNames; |
1137 |
|
procedure TIBTableFieldLinkProperty.SetMasterFields(const Value: string); |
1138 |
|
begin |
1139 |
|
FTable.MasterFields := Value; |
1140 |
< |
end;*) |
1140 |
> |
end; |
1141 |
|
|
1142 |
|
{ TIBUpdateSQLProperty } |
1143 |
|
|
1146 |
|
IBDataset: TIBDataset; |
1147 |
|
begin |
1148 |
|
IBDataset := GetComponent(0) as TIBDataset; |
1149 |
< |
if IBModifySQLEditor.EditSQL(IBDataSet.Database,IBDataSet.ModifySQL) then Modified; |
1149 |
> |
if IBModifySQLEditor.EditSQL(IBDataSet,IBDataSet.ModifySQL) then Modified; |
1150 |
|
end; |
1151 |
|
|
1152 |
|
{ TIBUpdateSQLUpdateProperty } |
1154 |
|
procedure TIBUpdateSQLUpdateProperty.Edit; |
1155 |
|
begin |
1156 |
|
GetObjects; |
1157 |
< |
if IBModifySQLEditor.EditSQL(FDatabase,FIBUpdateSQL.ModifySQL) then Modified; |
1157 |
> |
if IBModifySQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.ModifySQL) then Modified; |
1158 |
|
end; |
1159 |
|
|
1160 |
|
{ TIBRefreshSQLProperty } |
1162 |
|
procedure TIBRefreshSQLProperty.Edit; |
1163 |
|
var |
1164 |
|
IBDataset: TIBDataset; |
856 |
– |
aDatabase: TIBDatabase; |
1165 |
|
begin |
1166 |
|
IBDataset := GetComponent(0) as TIBDataset; |
1167 |
< |
if IBRefreshSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.RefreshSQL) then Modified; |
1167 |
> |
if IBRefreshSQLEditor.EditSQL(IBDataSet,IBDataSet.RefreshSQL) then Modified; |
1168 |
|
end; |
1169 |
|
|
1170 |
|
{ TIBUpdateSQLRefreshSQLProperty } |
1172 |
|
procedure TIBUpdateSQLRefreshSQLProperty.Edit; |
1173 |
|
begin |
1174 |
|
GetObjects; |
1175 |
< |
if IBRefreshSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.RefreshSQL) then Modified; |
1175 |
> |
if IBRefreshSQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.RefreshSQL) then Modified; |
1176 |
|
end; |
1177 |
|
|
1178 |
|
{ TIBDeleteSQLProperty } |
1179 |
|
|
1180 |
|
procedure TIBDeleteSQLProperty.Edit; |
1181 |
|
var |
1182 |
< |
IBDataset: TIBDataset; |
1182 |
> |
IBDataset: TIBDataSet; |
1183 |
|
begin |
1184 |
< |
IBDataset := GetComponent(0) as TIBDataset; |
1185 |
< |
if IBDeleteSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.DeleteSQL) then Modified; |
1184 |
> |
IBDataset := GetComponent(0) as TIBDataSet; |
1185 |
> |
if IBDeleteSQLEditor.EditSQL(IBDataSet,IBDataSet.DeleteSQL) then Modified; |
1186 |
|
end; |
1187 |
|
|
1188 |
|
{ TIBUpdateSQLDeleteProperty } |
1195 |
|
procedure TIBUpdateSQLDeleteProperty.Edit; |
1196 |
|
begin |
1197 |
|
GetObjects; |
1198 |
< |
if IBDeleteSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.DeleteSQL) then Modified; |
1198 |
> |
if IBDeleteSQLEditor.EditSQL(FIBUpdateSQL.DataSet,FIBUpdateSQL.DeleteSQL) then Modified; |
1199 |
|
end; |
1200 |
|
|
1201 |
|
{ TUpdateSQLPropertyEditor } |
1218 |
|
|
1219 |
|
procedure TIBInsertSQLProperty.Edit; |
1220 |
|
var |
1221 |
< |
IBDataset: TIBDataset; |
1221 |
> |
IBDataset: TIBDataSet; |
1222 |
|
begin |
1223 |
< |
IBDataset := GetComponent(0) as TIBDataset; |
1224 |
< |
if IBInsertSQLEditor.EditSQL(IBDataSet.Database,IBDataSet.InsertSQL) then Modified; |
1223 |
> |
IBDataset := GetComponent(0) as TIBDataSet; |
1224 |
> |
if IBInsertSQLEditor.EditSQL(IBDataSet,IBDataSet.InsertSQL) then Modified; |
1225 |
|
end; |
1226 |
|
|
1227 |
|
{ TIBUpdateSQLInsertSQLProperty } |
1229 |
|
procedure TIBUpdateSQLInsertSQLProperty.Edit; |
1230 |
|
begin |
1231 |
|
GetObjects; |
1232 |
< |
if IBInsertSQLEditor.EditSQL(FDatabase,FIBUpdateSQL.InsertSQL) then Modified; |
1232 |
> |
if IBInsertSQLEditor.EditSQL(FIBUpdateSQL.Dataset,FIBUpdateSQL.InsertSQL) then Modified; |
1233 |
|
end; |
1234 |
|
|
1235 |
|
{ TIBGeneratorProperty } |
1248 |
|
|
1249 |
|
procedure TIBSQLEditor.ExecuteVerb(Index: Integer); |
1250 |
|
begin |
1251 |
< |
if IBSQLEditor.EditIBSQL(TIBSQL(Component)) then Modified; |
1251 |
> |
if IBSQLEditor.EditSQL(TIBSQL(Component)) then Modified; |
1252 |
|
end; |
1253 |
|
|
1254 |
|
function TIBSQLEditor.GetVerb(Index: Integer): string; |
1255 |
|
begin |
1256 |
|
case Index of |
1257 |
|
0 : Result := SIBSQLEditor; |
1258 |
< |
1: Result := SInterbaseExpressVersion; |
1258 |
> |
1: Result := SInterbaseExpressVersion ; |
1259 |
|
end; |
1260 |
|
end; |
1261 |
|
|
1271 |
|
IBSQL: TIBSQL; |
1272 |
|
begin |
1273 |
|
IBSQL := GetComponent(0) as TIBSQL; |
1274 |
< |
if IBSQLEditor.EditIBSQL(IBSQL) then Modified; |
1274 |
> |
if IBSQLEditor.EditSQL(IBSQL) then Modified; |
1275 |
|
end; |
1276 |
|
|
1277 |
|
initialization |