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

Comparing ibx/trunk/runtime/nongui/IBTable.pas (file contents):
Revision 209 by tony, Wed Mar 14 12:48:51 2018 UTC vs.
Revision 312 by tony, Tue Aug 25 15:40:58 2020 UTC

# Line 161 | Line 161 | type
161      property EnableStatistics;
162      property Filter;
163      property Filtered;
164 +    property SQLFiltered;
165 +    property SQLFilterParams;
166      property GeneratorField;
167      property IndexDefs: TIndexDefs read FIndexDefs write SetIndexDefs stored IndexDefsStored;
168      property IndexFieldNames: string read GetIndexFieldNames write SetIndexFieldNames;
# Line 186 | Line 188 | type
188  
189   implementation
190  
191 < uses FBMessages, fpTimer;
191 > uses IBMessages, IBTypes;
192  
193   type
194  
# Line 195 | Line 197 | type
197    TIBMasterDataLink = class(TMasterDataLink)
198    private
199      FDelayTimerValue: integer;
200 <    FTimer: TFPTimer;
200 >    FTimer: TIBTimerInf;
201      procedure HandleRefreshTimer(Sender: TObject);
202 +    procedure SetDelayTimerValue(AValue: integer);
203    protected
204      procedure DoMasterChange; override;
205    public
206      constructor Create(ADataSet: TDataSet); override;
204    destructor Destroy; override;
207      property DelayTimerValue: integer {in Milliseconds}
208 <            read FDelayTimerValue write FDelayTimerValue;
208 >            read FDelayTimerValue write SetDelayTimerValue;
209    end;
210  
211   { TIBMasterDataLink }
212  
213   procedure TIBMasterDataLink.HandleRefreshTimer(Sender: TObject);
214   begin
215 <  FTimer.Interval := 0;
216 <  inherited DoMasterChange;
215 >  FTimer.Enabled := false;
216 >  if GetDetailDataSet.Active then
217 >    inherited DoMasterChange;
218 > end;
219 >
220 > procedure TIBMasterDataLink.SetDelayTimerValue(AValue: integer);
221 > begin
222 >  if FDelayTimerValue = AValue then Exit;
223 >  if assigned(FTimer) then
224 >    FTimer.Enabled := false;
225 >  FDelayTimerValue := AValue;
226   end;
227  
228   procedure TIBMasterDataLink.DoMasterChange;
229   begin
230 <  if FDelayTimerValue = 0 then
231 <    inherited DoMasterChange
221 <  else
230 >  if assigned(FTimer) and (FDelayTimerValue > 0) then
231 >  with FTimer do
232    begin
233 +    FTimer.Enabled := false;
234      FTimer.Interval := FDelayTimerValue;
235 <    FTimer.StartTimer;
236 <  end;
235 >    FTimer.Enabled := true;
236 >  end
237 >  else
238 >    inherited DoMasterChange
239   end;
240  
241   constructor TIBMasterDataLink.Create(ADataSet: TDataSet);
242   begin
243    inherited Create(ADataSet);
244 <  FTimer := TFPTimer.Create(nil);
245 <  FTimer.Enabled := true;
246 <  FTimer.Interval := 0;
247 <  FTimer.OnTimer := HandleRefreshTimer;
244 >  if assigned(IBGUIInterface) then
245 >  begin
246 >    FTimer := IBGUIInterface.CreateTimer;
247 >    if FTimer <> nil then
248 >    begin
249 >      FTimer.Enabled := false;
250 >      FTimer.Interval := 0;
251 >      FTimer.OnTimer := HandleRefreshTimer;
252 >    end;
253 >  end;
254    FDelayTimerValue := 0;
255   end;
256  
238 destructor TIBMasterDataLink.Destroy;
239 begin
240  if assigned(FTimer) then FTimer.Free;
241  inherited Destroy;
242 end;
243
257   { TIBTable }
258  
259   constructor TIBTable.Create(AOwner: TComponent);
# Line 541 | Line 554 | var
554          ExtractIdentifier(Database.SQLDialect,
555            QuoteIdentifier(DataBase.SQLDialect, Name)) +
556          ''' ' +
557 <        'AND RDB$CONSTRAINT_TYPE = ''PRIMARY KEY''';
557 >        'AND Trim(RDB$CONSTRAINT_TYPE) = ''PRIMARY KEY''';
558        Query.Prepare;
559        Query.ExecQuery;
560        if not Query.EOF then
# Line 735 | Line 748 | begin
748      Query.Database := DataBase;
749      Query.Transaction := Database.InternalTransaction;
750      Query.SQL.Text :=
751 <    'Select USER from RDB$RELATIONS where RDB$RELATION_NAME = ' + {do not localize}
751 >    'Select USER from RDB$RELATIONS where Trim(RDB$RELATION_NAME) = ' + {do not localize}
752      '''' +
753      ExtractIdentifier(Database.SQLDialect,
754        QuoteIdentifier(DataBase.SQLDialect, FTableName)) + '''';
# Line 982 | Line 995 | begin
995      Query.Database := DataBase;
996      Query.Transaction := Database.InternalTransaction;
997      Query.SQL.Text := 'Select RDB$SYSTEM_FLAG, RDB$DBKEY_LENGTH ' + {do not localize}
998 <                    'from RDB$RELATIONS where RDB$RELATION_NAME = ' + {do not localize}
998 >                    'from RDB$RELATIONS where Trim(RDB$RELATION_NAME)  = ' + {do not localize}
999                      '''' +
1000                      ExtractIdentifier(Database.SQLDialect,
1001                        QuoteIdentifier(DataBase.SQLDialect, FTableName)) + '''';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines