ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/udr/source/FBUDRUtils.pas
(Generate patch)

Comparing ibx/branches/udr/udr/source/FBUDRUtils.pas (file contents):
Revision 373 by tony, Thu Jan 6 14:14:57 2022 UTC vs.
Revision 396 by tony, Thu Feb 17 11:57:23 2022 UTC

# Line 85 | Line 85 | type
85      FAttachment: IAttachment;
86      FTransaction: ITransaction;
87    public
88 <    procedure Assign(src: Firebird.IExternalContext);
88 >    constructor Create(aController: TFBUDRController; context: Firebird.IExternalContext);
89      function AsText: AnsiString;
90    public
91      {IFBUDRExternalContext}
# Line 98 | Line 98 | type
98      function obtainInfoCode: Integer;
99      function getInfo(code: Integer): Pointer;
100      function setInfo(code: Integer; value: Pointer): Pointer;
101 +    function cloneAttachment: IAttachment;
102 +    function GetServiceManager: IServiceManager;
103      function HasConfigFile: boolean;
104      function ReadConfigString(Section, Ident, DefaultValue: AnsiString): AnsiString;
105      function ReadConfigInteger(Section, Ident: AnsiString; DefaultValue: integer): integer;
# Line 280 | Line 282 | function TFBUDRMessageMetadata.AsText: A
282  
283   var i: integer;
284   begin
285 <  Result := Format('Field Count = %d' + NewLineTAB,[getCount]) +
286 <            Format('Alignment = %d' + NewLineTAB,[getAlignment]) +
287 <            Format('Aligned Length = %d' + NewLineTAB,[getAlignedLength]);
285 >  Result := Format('Field Count = %d' + NewLineTAB,[getCount]);
286 >  if FMetadata.vTable.version >= 4 then
287 >  begin
288 >    Result := Result + Format('Alignment = %d' + NewLineTAB,[getAlignment]) +
289 >                Format('Aligned Length = %d' + NewLineTAB,[getAlignedLength]);
290 >  end;
291    for i := 0 to getCount - 1 do
292    begin
293      Result := Result +
# Line 291 | Line 296 | begin
296              Format('Relation Name = %s' + NewLineTAB,[getRelation(i)]) +
297              Format('Alias Name = %s' + NewLineTAB,[getAlias(i)]) +
298              Format('SQLType = %s' + NewLineTAB,[TSQLDataItem.GetSQLTypeName(getType(i))]) +
299 <            Format('IsNullable = %s' + NewLineTAB,[BoolToStr(isNullable(i){$ifdef FPC},'yes','no'{$endif})]) +
299 >            Format('IsNullable = %s' + NewLineTAB,[BooleanToStr(isNullable(i),'yes','no')]) +
300              Format('SubType = %d' + NewLineTAB,[getSubType(i)]) +
301              Format('Length = %d' + NewLineTAB,[getLength(i)]) +
302              Format('Scale = %d' + NewLineTAB,[getScale(i)]) +
# Line 549 | Line 554 | end;
554  
555   { TFBUDRExternalContext }
556  
557 < procedure TFBUDRExternalContext.Assign(src: Firebird.IExternalContext);
558 <
554 <  function SameTransaction: boolean;
555 <  var tr1, tr2: Firebird.ITransaction;
556 <  begin
557 <    Result := false;
558 <    if FContext = nil then Exit;
559 <    tr1 := src.getTransaction(FStatus);
560 <    CheckStatus;
561 <    tr2 := FContext.getTransaction(FStatus);
562 <    CheckStatus;
563 <    Result := tr1 = tr2;
564 <  end;
565 <
566 <  function SameAttachment: boolean;
567 <  var at1, at2: Firebird.IAttachment;
568 <  begin
569 <    Result := false;
570 <    if FContext = nil then Exit;
571 <    at1 := src.getAttachment(FStatus);
572 <    CheckStatus;
573 <    at2 := FContext.getAttachment(FStatus);
574 <    CheckStatus;
575 <    Result := at1 = at2;
576 <  end;
577 <
557 > constructor TFBUDRExternalContext.Create(aController: TFBUDRController;
558 >  context: Firebird.IExternalContext);
559   begin
560 <  if src = FContext then Exit;
561 <
562 <  if src = nil then
563 <  begin
583 <    FirebirdAPI := nil;
584 <    FTransaction := nil;
585 <    FAttachment := nil;
586 <    FContext := nil;
587 <  end
588 <  else
589 <  begin
590 <    if (FContext = nil) or (src.getMaster() <> FContext.getMaster) then
591 <      FirebirdAPI := TFB30ClientAPI.Create(src.getMaster);
592 <
593 <    if not SameTransaction then
594 <      FTransaction := nil;
595 <
596 <    if not SameAttachment then
597 <      FAttachment := nil;
598 <
599 <    FContext := src;
600 <  end;
560 >  inherited Create(aController);
561 >  FContext := context;
562 >  FirebirdAPI := TFB30ClientAPI.Create(context.getMaster);
563 >  aController.StartJournaling(self);
564   end;
565  
566   function TFBUDRExternalContext.AsText: AnsiString;
# Line 672 | Line 635 | begin
635    Result := FContext.setInfo(code,value);
636   end;
637  
638 + function TFBUDRExternalContext.cloneAttachment: IAttachment;
639 + var DPB: IDPB;
640 + begin
641 +  DPB := GetFirebirdAPI.AllocateDPB;
642 +  DPB.Add(isc_dpb_user_name).setAsString(GetUserName);
643 +  DPB.Add(isc_dpb_lc_ctype).setAsString(GetClientCharSet);
644 +  Result := GetFirebirdAPI.OpenDatabase(GetDatabaseName,DPB);
645 + end;
646 +
647 + function TFBUDRExternalContext.GetServiceManager: IServiceManager;
648 + var SPB: ISPB;
649 + begin
650 +  SPB := FirebirdAPI.AllocateSPB;
651 +  SPB.Add(isc_spb_user_name).setAsString(GetUserName);
652 +  Result := GetFirebirdAPI.GetServiceManager('',Local,SPB);
653 + end;
654 +
655   function TFBUDRExternalContext.HasConfigFile: boolean;
656   begin
657    Result := Controller.HasConfigFile;
# Line 812 | Line 792 | begin
792    Result := Format('Package Name = %s' + NewLineTAB,[getPackage]) +
793              Format('Name = %s' + NewLineTAB,[getName]) +
794              Format('Entry Point = %s (%s,%s,%s)' + NewLineTAB,[getEntryPoint,getModuleName,getRoutineName,getInfo]) +
795 <            Format('Body = %s' + NewLineTAB,[getBody]) +
796 <            Format('Input Metadata:' + NewLineTAB + '%s',[MetadataToText(FInputMetaData)]) + LineEnding +
797 <            Format('Output Metadata:' + NewLineTAB + '%s',[MetadataToText(FOutputMetaData)]);
795 >            Format('Body = %s' + NewLineTAB,[getBody]);
796 >  if HasInputMetaData then
797 >    Result := Result + Format('Input Metadata:' + NewLineTAB + '%s',[MetadataToText(FInputMetaData)]) + LineEnding;
798 >  if HasOutputMetaData then
799 >    Result := Result + Format('Output Metadata:' + NewLineTAB + '%s',[MetadataToText(FOutputMetaData)]);
800    if FRoutineMetadata.getTriggerType(FStatus) > 0 then
801    begin
802 +    if HasTriggerMetaData then
803 +      Result := Result + Format('Trigger Metadata:' + NewLineTAB + '%s',[MetadataToText(FTriggerMetaData)]);
804      Result := Result +
821    Format('Trigger Metadata:' + NewLineTAB + '%s',[MetadataToText(FTriggerMetaData)]) +
805      Format('Trigger Table = %s' + NewLineTAB,[getTriggerTable]) +
806      Format('Trigger Type = %s' + NewLineTAB,[TriggerTypeToText(getTriggerType)]);
807    end;

Comparing ibx/branches/udr/udr/source/FBUDRUtils.pas (property svn:eol-style):
Revision 373 by tony, Thu Jan 6 14:14:57 2022 UTC vs.
Revision 396 by tony, Thu Feb 17 11:57:23 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines