ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/nongui/IBUpdate.pas
(Generate patch)

Comparing ibx/trunk/runtime/nongui/IBUpdate.pas (file contents):
Revision 380 by tony, Mon Jan 10 10:13:17 2022 UTC vs.
Revision 410 by tony, Thu Jun 22 13:52:39 2023 UTC

# Line 41 | Line 41 | type
41  
42    TIBUpdate = class(TIBDataSetUpdateObject)
43    private
44    FDataSet: TIBCustomDataSet;
44      FDummySQL: TStrings;
45      FOnApplyUpdates: TOnApplyUpdates;
46    protected
47      function GetSQL(UpdateKind: TUpdateKind): TStrings; override;
48 <    function GetDataSet: TIBCustomDataSet; override;
50 <    procedure SetDataSet(ADataSet: TIBCustomDataSet); override;
51 <    procedure Apply(UpdateKind: TUpdateKind; buff: PChar); override;
48 >    procedure Apply(UpdateKind: TUpdateKind; buff: TRecordBuffer); override;
49    public
50      constructor Create(AOwner: TComponent); override;
51      destructor Destroy; override;
# Line 60 | Line 57 | type
57  
58   implementation
59  
60 < uses variants, FmtBCD, DateUtils;
60 > uses variants, FmtBCD, DateUtils, FBNumeric;
61  
62   type
63  
# Line 89 | Line 86 | type
86      {ISQLParams}
87      function getCount: integer;
88      function getSQLParam(index: integer): ISQLParam;
89 +    function ParamExists(Idx: AnsiString): boolean;
90      function ByName(Idx: AnsiString): ISQLParam ;
91      function GetModified: Boolean;
92      function GetHasCaseSensitiveParams: Boolean;
93 +    function GetStatement: IStatement;
94 +    function GetTransaction: ITransaction;
95 +    function GetAttachment: IAttachment;
96 +    procedure Clear;
97    end;
98  
99    { TParamIntf }
# Line 137 | Line 139 | type
139      function GetAsBlob: IBlob;
140      function GetAsArray: IArray;
141      function GetAsBCD: tBCD;
142 +    function GetAsNumeric: IFBNumeric;
143      function GetStatement: IStatement;
144      function GetTransaction: ITransaction;
145 +    function GetAttachment: IAttachment;
146      procedure Clear;
147      function GetModified: boolean;
148      procedure SetAsBoolean(AValue: boolean);
# Line 167 | Line 171 | type
171      procedure SetAsQuad(aValue: TISC_QUAD);
172      procedure SetCharSetID(aValue: cardinal);
173      procedure SetAsBcd(aValue: tBCD);
174 +    procedure SetAsNumeric(Value: IFBNumeric);
175    end;
176  
177   { TParamIntf }
# Line 241 | Line 246 | end;
246  
247   function TParamIntf.GetAsBoolean: boolean;
248   begin
249 <  Result := FOwner.FParams[FIndex].Value;
249 >  if VarIsNull(FOwner.FParams[FIndex].Value) then
250 >    Result := false
251 >  else
252 >    Result := FOwner.FParams[FIndex].Value;
253   end;
254  
255   function TParamIntf.GetAsCurrency: Currency;
# Line 462 | Line 470 | begin
470    Result := VarToBCD(FOwner.FParams[FIndex].Value);
471   end;
472  
473 + function TParamIntf.GetAsNumeric: IFBNumeric;
474 + begin
475 +  IBError(ibxeNotSupported,[]);
476 + end;
477 +
478   function TParamIntf.GetStatement: IStatement;
479   begin
480    IBError(ibxeNotSupported,[]);
# Line 472 | Line 485 | begin
485    IBError(ibxeNotSupported,[]);
486   end;
487  
488 + function TParamIntf.GetAttachment: IAttachment;
489 + begin
490 +  IBError(ibxeNotSupported,[]);
491 + end;
492 +
493   procedure TParamIntf.Clear;
494   begin
495    FOwner.SetParam(FIndex,NULL);
# Line 638 | Line 656 | begin
656    FOwner.SetParam(FIndex,VarFmtBCDCreate(AValue));
657   end;
658  
659 + procedure TParamIntf.SetAsNumeric(Value: IFBNumeric);
660 + begin
661 +  IBError(ibxeNotSupported,[]);
662 + end;
663 +
664   { TParamListIntf }
665  
666   procedure TParamListIntf.SetParam(index: integer; aValue: variant);
# Line 697 | Line 720 | begin
720    Result := TParamIntf.Create(self,index);
721   end;
722  
723 + function TParamListIntf.ParamExists(Idx: AnsiString): boolean;
724 + begin
725 +  Result := ByName(Idx) <> nil;
726 + end;
727 +
728   function TParamListIntf.ByName(Idx: AnsiString): ISQLParam;
729   var i: integer;
730   begin
# Line 719 | Line 747 | begin
747    Result := false;
748   end;
749  
750 < { TIBUpdate }
750 > function TParamListIntf.GetStatement: IStatement;
751 > begin
752 >  IBError(ibxeNotSupported,[]);
753 > end;
754  
755 < function TIBUpdate.GetSQL(UpdateKind: TUpdateKind): TStrings;
755 > function TParamListIntf.GetTransaction: ITransaction;
756   begin
757 <  Result := FDummySQL; {non empty result}
757 >  IBError(ibxeNotSupported,[]);
758   end;
759  
760 < function TIBUpdate.GetDataSet: TIBCustomDataSet;
760 > function TParamListIntf.GetAttachment: IAttachment;
761   begin
762 <  Result := FDataSet;
762 >  Result := Database.Attachment;
763   end;
764  
765 < procedure TIBUpdate.SetDataSet(ADataSet: TIBCustomDataSet);
765 > procedure TParamListIntf.Clear;
766 > var i: integer;
767   begin
768 <  FDataSet := ADataset;
768 >  for i := 0 to getCount - 1 do
769 >    getSQLParam(i).Clear;
770 > end;
771 >
772 > { TIBUpdate }
773 >
774 > function TIBUpdate.GetSQL(UpdateKind: TUpdateKind): TStrings;
775 > begin
776 >  Result := FDummySQL; {non empty result}
777   end;
778  
779 < procedure TIBUpdate.Apply(UpdateKind: TUpdateKind; buff: PChar);
779 > procedure TIBUpdate.Apply(UpdateKind: TUpdateKind; buff: TRecordBuffer);
780   var Params: ISQLParams;
781   begin
782    Params := TParamListIntf.Create(Dataset.Fields,(DataSet.Database as TIBDatabase));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines