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 291 by tony, Fri Apr 17 10:26:08 2020 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 968 | Line 973 | const
973  
974   implementation
975  
976 < uses Variants, FmtBCD, LazUTF8, FBMessages, IBQuery;
976 > uses Variants, FmtBCD, LazUTF8, IBMessages, IBQuery;
977  
978   type
979  
# 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 2993 | Line 3025 | procedure TIBCustomDataSet.SetUniDirecti
3025   begin
3026    CheckDatasetClosed;
3027    FUniDirectional := Value;
3028 +  inherited SetUniDirectional(Value);
3029   end;
3030  
3031   procedure TIBCustomDataSet.SetUpdateRecordTypes(Value: TIBUpdateRecordTypes);
# Line 3102 | Line 3135 | end;
3135  
3136   function TIBCustomDataSet.ParamByName(ParamName: String): ISQLParam;
3137   begin
3138 +  Result := FindParam(ParamName);
3139 +  if Result = nil then
3140 +    IBError(ibxeParameterNameNotFound,[ParamName]);
3141 + end;
3142 +
3143 + function TIBCustomDataSet.FindParam(ParamName: String): ISQLParam;
3144 + begin
3145    ActivateConnection;
3146    ActivateTransaction;
3147    if not FInternalPrepared then
3148      InternalPrepare;
3149    Result := Params.ByName(ParamName);
3110  if Result = nil then
3111    IBError(ibxeParameterNameNotFound,[ParamName]);
3150   end;
3151  
3152   function TIBCustomDataSet.GetRowsAffected(var SelectCount, InsertCount,
# Line 3457 | Line 3495 | begin
3495      ApplyUpdates;
3496   end;
3497  
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
3498   procedure TIBCustomDataSet.DoBeforePost;
3499   begin
3500    inherited DoBeforePost;
# Line 5231 | Line 5257 | end;
5257  
5258   procedure TIBGenerator.SetQuerySQL;
5259   begin
5260 <  FQuery.SQL.Text := Format('Select Gen_ID(%s,%d) From RDB$Database',[FGeneratorName,Increment]);
5260 >  if Database <> nil then
5261 >    FQuery.SQL.Text := Format('Select Gen_ID(%s,%d) From RDB$Database',
5262 >      [QuoteIdentifierIfNeeded(Database.SQLDialect,FGeneratorName),Increment]);
5263   end;
5264  
5265   function TIBGenerator.GetDatabase: TIBDatabase;
# Line 5247 | Line 5275 | end;
5275   procedure TIBGenerator.SetDatabase(AValue: TIBDatabase);
5276   begin
5277    FQuery.Database := AValue;
5278 +  SetQuerySQL;
5279   end;
5280  
5281   procedure TIBGenerator.SetGeneratorName(AValue: string);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines