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 221 by tony, Mon Mar 19 09:48:37 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;
205    destructor Destroy; override;
207      property DelayTimerValue: integer {in Milliseconds}
208              read FDelayTimerValue write SetDelayTimerValue;
209    end;
# Line 219 | Line 220 | end;
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;
223  {$IF FPC_FULLVERSION >= 30002}
224  if (AValue > 0) and not IsMultiThread then
225    IBError(ibxeMultiThreadRequired,['TIBTable MasterDetailDelay']);
226  FTimer.Interval := FDelayTimerValue;
227  {$IFEND}
226   end;
227  
228   procedure TIBMasterDataLink.DoMasterChange;
229   begin
230 <  {$IF FPC_FULLVERSION >= 30002}
233 <  if FDelayTimerValue > 0 then
230 >  if assigned(FTimer) and (FDelayTimerValue > 0) then
231    with FTimer do
232    begin
233 <    CheckSynchronize; {Ensure not waiting on Synchronize}
234 <    if Enabled then
235 <    begin
239 <      StopTimer;
240 <      StartTimer;
241 <    end
242 <    else
243 <      Enabled := true;
233 >    FTimer.Enabled := false;
234 >    FTimer.Interval := FDelayTimerValue;
235 >    FTimer.Enabled := true;
236    end
237    else
246  {$IFEND}
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 := false;
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  
260 destructor TIBMasterDataLink.Destroy;
261 begin
262  if assigned(FTimer) then FTimer.Free;
263  inherited Destroy;
264 end;
265
257   { TIBTable }
258  
259   constructor TIBTable.Create(AOwner: TComponent);
# Line 563 | 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 757 | 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 1004 | 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