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 263 by tony, Thu Dec 6 15:55:01 2018 UTC vs.
Revision 291 by tony, Fri Apr 17 10:26:08 2020 UTC

# Line 399 | Line 399 | type
399      FArrayFieldCount: integer;
400      FArrayCacheOffset: integer;
401      FAutoCommit: TIBAutoCommit;
402 +    FCaseSensitiveParameterNames: boolean;
403      FEnableStatistics: boolean;
404      FGenerateParamNames: Boolean;
405      FGeneratorField: TIBGenerator;
# Line 474 | Line 475 | type
475        FieldIndex: integer; Buffer: PChar);
476      procedure InitModelBuffer(Qry: TIBSQL; Buffer: PChar);
477      function GetSelectStmtIntf: IStatement;
478 +    procedure SetCaseSensitiveParameterNames(AValue: boolean);
479      procedure SetUpdateMode(const Value: TUpdateMode);
480      procedure SetUpdateObject(Value: TIBDataSetUpdateObject);
481  
# Line 591 | Line 593 | type
593      procedure DoBeforeInsert; override;
594      procedure DoAfterInsert; override;
595      procedure DoBeforeClose; override;
594    procedure DoBeforeOpen; override;
596      procedure DoBeforePost; override;
597      procedure DoAfterPost; override;
598      procedure FreeRecordBuffer(var Buffer: PChar); override;
# Line 652 | Line 653 | type
653      property SelectStmtHandle: IStatement read GetSelectStmtIntf;
654  
655      {Likely to be made published by descendant classes}
656 +    property CaseSensitiveParameterNames: boolean read FCaseSensitiveParameterNames
657 +                                                  write SetCaseSensitiveParameterNames;
658      property BufferChunks: Integer read FBufferChunks write SetBufferChunks;
659      property CachedUpdates: Boolean read FCachedUpdates write SetCachedUpdates;
660      property UniDirectional: Boolean read FUniDirectional write SetUniDirectional default False;
# Line 716 | 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 773 | 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 810 | Line 819 | type
819      property AutoCommit;
820      property BufferChunks;
821      property CachedUpdates;
822 +    property CaseSensitiveParameterNames;
823      property EnableStatistics;
824      property DeleteSQL;
825      property InsertSQL;
# Line 963 | 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 1025 | 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 2988 | 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 3097 | 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
# Line 3450 | Line 3495 | begin
3495      ApplyUpdates;
3496   end;
3497  
3453 procedure TIBCustomDataSet.DoBeforeOpen;
3454 var i: integer;
3455 begin
3456  if assigned(FParser) then
3457     FParser.RestoreClauseValues;
3458  for i := 0 to FIBLinks.Count - 1 do
3459    TIBControlLink(FIBLinks[i]).UpdateSQL(self);
3460  inherited DoBeforeOpen;
3461  for i := 0 to FIBLinks.Count - 1 do
3462    TIBControlLink(FIBLinks[i]).UpdateParams(self);
3463 end;
3464
3498   procedure TIBCustomDataSet.DoBeforePost;
3499   begin
3500    inherited DoBeforePost;
# Line 4750 | Line 4783 | begin
4783    Result := FQSelect.Statement;
4784   end;
4785  
4786 + procedure TIBCustomDataSet.SetCaseSensitiveParameterNames(AValue: boolean);
4787 + begin
4788 +  if FCaseSensitiveParameterNames = AValue then Exit;
4789 +  FCaseSensitiveParameterNames := AValue;
4790 +  if assigned(FQSelect) then
4791 +    FQSelect.CaseSensitiveParameterNames := AValue;
4792 + end;
4793 +
4794   procedure TIBCustomDataSet.SetMasterDetailDelay(AValue: integer);
4795   begin
4796    FDataLink.DelayTimerValue := AValue;
# Line 5216 | 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 5232 | 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