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

Comparing ibx/trunk/runtime/nongui/IBCustomDataSet.pas (file contents):
Revision 270 by tony, Fri Jan 18 11:10:37 2019 UTC vs.
Revision 272 by tony, Mon Feb 4 13:34:37 2019 UTC

# Line 593 | Line 593 | type
593      procedure DoBeforeInsert; override;
594      procedure DoAfterInsert; override;
595      procedure DoBeforeClose; override;
596    procedure DoBeforeOpen; override;
596      procedure DoBeforePost; override;
597      procedure DoAfterPost; override;
598      procedure FreeRecordBuffer(var Buffer: PChar); override;
# Line 720 | Line 719 | type
719      function IsSequenced: Boolean; override;
720      procedure Post; override;
721      function ParamByName(ParamName: String): ISQLParam;
722 +    function FindParam(ParamName: String): ISQLParam;
723      property ArrayFieldCount: integer read FArrayFieldCount;
724      property DatabaseInfo: TIBDatabaseInfo read FDatabaseInfo;
725      property UpdateObject: TIBDataSetUpdateObject read FUpdateObject write SetUpdateObject;
# Line 777 | Line 777 | type
777                                                     write FOnDeleteReturning;
778    end;
779  
780 +  { TIBParserDataSet }
781 +
782    TIBParserDataSet = class(TIBCustomDataSet)
783 +  protected
784 +    procedure SetFilterText(const Value: string); override;
785 +    procedure DoBeforeOpen; override;
786    public
787      property Parser;
788    end;
# Line 1030 | Line 1035 | type
1035      Result := str;
1036    end;
1037  
1038 + { TIBParserDataSet }
1039 +
1040 + procedure TIBParserDataSet.SetFilterText(const Value: string);
1041 + begin
1042 +  if Filter = Value then Exit;
1043 +  inherited SetFilterText(Value);
1044 +  if Active and Filtered then {reopen dataset}
1045 +  begin
1046 +    Active := false;
1047 +    Active := true;
1048 +  end;
1049 + end;
1050 +
1051 + procedure TIBParserDataSet.DoBeforeOpen;
1052 + var i: integer;
1053 + begin
1054 +  if assigned(FParser) then
1055 +     FParser.RestoreClauseValues;
1056 +  if Filtered and (Filter <> '') then
1057 +    Parser.Add2WhereClause(Filter);
1058 +  for i := 0 to FIBLinks.Count - 1 do
1059 +    TIBControlLink(FIBLinks[i]).UpdateSQL(self);
1060 +  inherited DoBeforeOpen;
1061 +  for i := 0 to FIBLinks.Count - 1 do
1062 +    TIBControlLink(FIBLinks[i]).UpdateParams(self);
1063 + end;
1064 +
1065   { TIBLargeIntField }
1066  
1067   procedure TIBLargeIntField.Bind(Binding: Boolean);
# Line 3102 | Line 3134 | end;
3134  
3135   function TIBCustomDataSet.ParamByName(ParamName: String): ISQLParam;
3136   begin
3137 +  Result := FindParam(ParamName);
3138 +  if Result = nil then
3139 +    IBError(ibxeParameterNameNotFound,[ParamName]);
3140 + end;
3141 +
3142 + function TIBCustomDataSet.FindParam(ParamName: String): ISQLParam;
3143 + begin
3144    ActivateConnection;
3145    ActivateTransaction;
3146    if not FInternalPrepared then
3147      InternalPrepare;
3148    Result := Params.ByName(ParamName);
3110  if Result = nil then
3111    IBError(ibxeParameterNameNotFound,[ParamName]);
3149   end;
3150  
3151   function TIBCustomDataSet.GetRowsAffected(var SelectCount, InsertCount,
# Line 3457 | Line 3494 | begin
3494      ApplyUpdates;
3495   end;
3496  
3460 procedure TIBCustomDataSet.DoBeforeOpen;
3461 var i: integer;
3462 begin
3463  if assigned(FParser) then
3464     FParser.RestoreClauseValues;
3465  for i := 0 to FIBLinks.Count - 1 do
3466    TIBControlLink(FIBLinks[i]).UpdateSQL(self);
3467  inherited DoBeforeOpen;
3468  for i := 0 to FIBLinks.Count - 1 do
3469    TIBControlLink(FIBLinks[i]).UpdateParams(self);
3470 end;
3471
3497   procedure TIBCustomDataSet.DoBeforePost;
3498   begin
3499    inherited DoBeforePost;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines