39 |
|
|
40 |
|
interface |
41 |
|
|
42 |
< |
uses SysUtils, Classes, DB, IB, IBCustomDataSet, |
43 |
< |
IBSQL, IBUtils; |
42 |
> |
uses SysUtils, Classes, DB, IB, IBCustomDataSet, IBDatabase, IBSQL, IBUtils; |
43 |
|
|
44 |
|
type |
45 |
|
|
160 |
|
property EnableStatistics; |
161 |
|
property Filter; |
162 |
|
property Filtered; |
163 |
+ |
property SQLFiltered; |
164 |
+ |
property SQLFilterParams; |
165 |
|
property GeneratorField; |
166 |
|
property IndexDefs: TIndexDefs read FIndexDefs write SetIndexDefs stored IndexDefsStored; |
167 |
|
property IndexFieldNames: string read GetIndexFieldNames write SetIndexFieldNames; |
187 |
|
|
188 |
|
implementation |
189 |
|
|
190 |
< |
uses FBMessages, fpTimer; |
190 |
> |
uses IBMessages, IBInternals; |
191 |
|
|
192 |
|
type |
193 |
|
|
196 |
|
TIBMasterDataLink = class(TMasterDataLink) |
197 |
|
private |
198 |
|
FDelayTimerValue: integer; |
199 |
< |
FTimer: TFPTimer; |
199 |
> |
FTimer: IIBTimerInf; |
200 |
|
procedure HandleRefreshTimer(Sender: TObject); |
201 |
|
procedure SetDelayTimerValue(AValue: integer); |
202 |
|
protected |
203 |
|
procedure DoMasterChange; override; |
204 |
|
public |
205 |
|
constructor Create(ADataSet: TDataSet); override; |
205 |
– |
destructor Destroy; override; |
206 |
|
property DelayTimerValue: integer {in Milliseconds} |
207 |
|
read FDelayTimerValue write SetDelayTimerValue; |
208 |
|
end; |
219 |
|
procedure TIBMasterDataLink.SetDelayTimerValue(AValue: integer); |
220 |
|
begin |
221 |
|
if FDelayTimerValue = AValue then Exit; |
222 |
+ |
if assigned(FTimer) then |
223 |
+ |
FTimer.Enabled := false; |
224 |
|
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} |
225 |
|
end; |
226 |
|
|
227 |
|
procedure TIBMasterDataLink.DoMasterChange; |
228 |
|
begin |
229 |
< |
{$IF FPC_FULLVERSION >= 30002} |
233 |
< |
if FDelayTimerValue > 0 then |
229 |
> |
if assigned(FTimer) and (FDelayTimerValue > 0) then |
230 |
|
with FTimer do |
231 |
|
begin |
232 |
< |
CheckSynchronize; {Ensure not waiting on Synchronize} |
233 |
< |
if Enabled then |
234 |
< |
begin |
239 |
< |
StopTimer; |
240 |
< |
StartTimer; |
241 |
< |
end |
242 |
< |
else |
243 |
< |
Enabled := true; |
232 |
> |
FTimer.Enabled := false; |
233 |
> |
FTimer.Interval := FDelayTimerValue; |
234 |
> |
FTimer.Enabled := true; |
235 |
|
end |
236 |
|
else |
246 |
– |
{$IFEND} |
237 |
|
inherited DoMasterChange |
238 |
|
end; |
239 |
|
|
240 |
|
constructor TIBMasterDataLink.Create(ADataSet: TDataSet); |
241 |
|
begin |
242 |
|
inherited Create(ADataSet); |
243 |
< |
FTimer := TFPTimer.Create(nil); |
244 |
< |
FTimer.Enabled := false; |
245 |
< |
FTimer.Interval := 0; |
246 |
< |
FTimer.OnTimer := HandleRefreshTimer; |
243 |
> |
if assigned(IBGUIInterface) then |
244 |
> |
begin |
245 |
> |
FTimer := IBGUIInterface.CreateTimer; |
246 |
> |
if FTimer <> nil then |
247 |
> |
begin |
248 |
> |
FTimer.Enabled := false; |
249 |
> |
FTimer.Interval := 0; |
250 |
> |
FTimer.OnTimer := HandleRefreshTimer; |
251 |
> |
end; |
252 |
> |
end; |
253 |
|
FDelayTimerValue := 0; |
254 |
|
end; |
255 |
|
|
260 |
– |
destructor TIBMasterDataLink.Destroy; |
261 |
– |
begin |
262 |
– |
if assigned(FTimer) then FTimer.Free; |
263 |
– |
inherited Destroy; |
264 |
– |
end; |
265 |
– |
|
256 |
|
{ TIBTable } |
257 |
|
|
258 |
|
constructor TIBTable.Create(AOwner: TComponent); |
553 |
|
ExtractIdentifier(Database.SQLDialect, |
554 |
|
QuoteIdentifier(DataBase.SQLDialect, Name)) + |
555 |
|
''' ' + |
556 |
< |
'AND RDB$CONSTRAINT_TYPE = ''PRIMARY KEY'''; |
556 |
> |
'AND Trim(RDB$CONSTRAINT_TYPE) = ''PRIMARY KEY'''; |
557 |
|
Query.Prepare; |
558 |
|
Query.ExecQuery; |
559 |
|
if not Query.EOF then |
747 |
|
Query.Database := DataBase; |
748 |
|
Query.Transaction := Database.InternalTransaction; |
749 |
|
Query.SQL.Text := |
750 |
< |
'Select USER from RDB$RELATIONS where RDB$RELATION_NAME = ' + {do not localize} |
750 |
> |
'Select USER from RDB$RELATIONS where Trim(RDB$RELATION_NAME) = ' + {do not localize} |
751 |
|
'''' + |
752 |
|
ExtractIdentifier(Database.SQLDialect, |
753 |
|
QuoteIdentifier(DataBase.SQLDialect, FTableName)) + ''''; |
862 |
|
FieldList := FieldList + |
863 |
|
QuoteIdentifier(DataBase.SQLDialect, Name) + |
864 |
|
' BLOB SUB_TYPE 0'; {do not localize} |
865 |
+ |
ftFmtBCD: |
866 |
+ |
if Database.Attachment.HasDecFloatSupport then |
867 |
+ |
FieldList := FieldList + |
868 |
+ |
QuoteIdentifier(DataBase.SQLDialect, Name) + |
869 |
+ |
' Decfloat(34)' {do not localize} |
870 |
+ |
else |
871 |
+ |
IBError(ibxeFieldUnsupportedType,[nil]); |
872 |
|
ftUnknown, ftADT, ftArray, ftReference, ftDataSet, |
873 |
|
ftCursor, ftWideString, ftAutoInc: |
874 |
|
IBError(ibxeFieldUnsupportedType,[nil]); |
965 |
|
if Active then |
966 |
|
begin |
967 |
|
ClearBuffers; |
968 |
+ |
ResetBufferCache; |
969 |
|
DataEvent(deDataSetChange, 0); |
970 |
|
end; |
971 |
|
finally |
1002 |
|
Query.Database := DataBase; |
1003 |
|
Query.Transaction := Database.InternalTransaction; |
1004 |
|
Query.SQL.Text := 'Select RDB$SYSTEM_FLAG, RDB$DBKEY_LENGTH ' + {do not localize} |
1005 |
< |
'from RDB$RELATIONS where RDB$RELATION_NAME = ' + {do not localize} |
1005 |
> |
'from RDB$RELATIONS where Trim(RDB$RELATION_NAME) = ' + {do not localize} |
1006 |
|
'''' + |
1007 |
|
ExtractIdentifier(Database.SQLDialect, |
1008 |
|
QuoteIdentifier(DataBase.SQLDialect, FTableName)) + ''''; |