-
Notifications
You must be signed in to change notification settings - Fork 58
/
FIBDataSetPT.inc
351 lines (283 loc) · 9.89 KB
/
FIBDataSetPT.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
{***************************************************************}
{ FIBPlus - component library for direct access to Firebird and }
{ InterBase databases }
{ }
{ FIBPlus is based in part on the product }
{ Free IB Components, written by Gregory H. Deatz for }
{ Hoagland, Longo, Moran, Dunst & Doukas Company. }
{ mailto:[email protected] }
{ }
{ Copyright (c) 1998-2007 Devrace Ltd. }
{ Written by Serge Buzadzhy ([email protected]) }
{ }
{ ------------------------------------------------------------- }
{ FIBPlus home page: http://www.fibplus.com/ }
{ FIBPlus support : http://www.devrace.com/support/ }
{ ------------------------------------------------------------- }
{ }
{ Please see the file License.txt for full license information }
{***************************************************************}
{$IFDEF FIB_INTERFACE}
FCurOption:TpFIBDsOption;
FCurPrepareOption:TpPrepareOption;
FCurDetailCondition :TDetailCondition;
FLoadingPrepared :boolean;
procedure ReadOption (Reader: TReader);
procedure WriteOption(Writer: TWriter);
procedure ReadPrepareOption (Reader: TReader);
procedure WritePrepareOption(Writer: TWriter);
procedure ReadDetailCondition (Reader: TReader);
procedure WriteDetailCondition(Writer: TWriter);
procedure ReadOV(Reader: TReader);
procedure ReadBufferChunks(Reader: TReader);
procedure DefineProperties(Filer: TFiler); override;
{$ENDIF}
{$IFDEF FIB_IMPLEMENT}
procedure TFIBCustomDataSet.ReadOV(Reader: TReader);
begin
Reader.ReadBoolean
end;
procedure TFIBCustomDataSet.ReadOption(Reader: TReader);
begin
if Reader.ReadBoolean then
Options:=Options+[FCurOption]
else
Options:=Options-[FCurOption];
end;
procedure TFIBCustomDataSet.WriteOption(Writer: TWriter);
begin
Writer.WriteBoolean(FCurOption in Options)
end;
procedure TFIBCustomDataSet.ReadPrepareOption (Reader: TReader);
begin
if Reader.ReadBoolean then
PrepareOptions:=PrepareOptions+[FCurPrepareOption]
else
PrepareOptions:=PrepareOptions-[FCurPrepareOption];
end;
procedure TFIBCustomDataSet.WritePrepareOption(Writer: TWriter);
begin
Writer.WriteBoolean(FCurPrepareOption in PrepareOptions)
end;
procedure TFIBCustomDataSet.ReadDetailCondition (Reader: TReader);
begin
if Reader.ReadBoolean then
DetailConditions:=DetailConditions+[FCurDetailCondition ]
else
DetailConditions:=DetailConditions-[FCurDetailCondition];
end;
procedure TFIBCustomDataSet.WriteDetailCondition(Writer: TWriter);
begin
Writer.WriteBoolean(FCurDetailCondition in DetailConditions)
end;
procedure TFIBCustomDataSet.ReadBufferChunks(Reader: TReader);
begin
BufferChunks:=Reader.ReadInteger
end;
procedure TFIBCustomDataSet.DefineProperties(Filer: TFiler);
var
IsWriteProcess:boolean;
function DoSaveDetailCond:boolean;
begin
if IsWriteProcess then
if Filer.Ancestor <> nil then
begin
Result:= ([FCurDetailCondition]*TFIBDataSet(Filer.Ancestor).DetailConditions)<>
([FCurDetailCondition]*DetailConditions)
end
else
Result:=FCurDetailCondition in DetailConditions
else
Result := False;
end;
function DoSavePrepareOption(WriteTrueValue:boolean):boolean;
begin
if IsWriteProcess then
if Filer.Ancestor <> nil then
begin
Result:= ([FCurPrepareOption]*TFIBDataSet(Filer.Ancestor).PrepareOptions)<>
([FCurPrepareOption]*PrepareOptions)
end
else
begin
if WriteTrueValue then
Result:=FCurPrepareOption in PrepareOptions
else
Result:=not (FCurPrepareOption in PrepareOptions)
end
else
Result := False;
end;
function DoSaveOption(WhenInclude:boolean):boolean;
begin
if IsWriteProcess then
if Filer.Ancestor <> nil then
begin
Result:= ([FCurOption]*TFIBDataSet(Filer.Ancestor).Options)<>
([FCurOption]*Options)
end
else
begin
if WhenInclude then
Result:=FCurOption in Options
else
Result:=not (FCurOption in Options)
end
else
Result := False;
end;
begin
inherited;
IsWriteProcess:=not (Filer is TReader);
if (csDesigning in ComponentState) and not IsWriteProcess and not FLoadingPrepared then
begin
// Paste component in DesignTime
// Clear Values from tools
FOptions:=StatDefDataSetOptions;
// [poTrimCharFields,poStartTransaction,poAutoFormatFields,poRefreshAfterPost];
FDetailConditions:=[];
FPrepareOptions :=StatDefPrepareOptions;
FLoadingPrepared :=True;
end;
with Filer do
begin
DefineProperty('BufferChunks', ReadBufferChunks , nil,False);
FCurPrepareOption:=psUseBooleanField;
DefineProperty('poUseBooleanField', ReadPrepareOption , WritePrepareOption,
DoSavePrepareOption(False)
);
FCurPrepareOption:=psUseGuidField;
DefineProperty('poUseGuidField', ReadPrepareOption , WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=psUseLargeIntField;
DefineProperty('poUseLargeIntField', ReadPrepareOption , WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=pfImportDefaultValues;
DefineProperty('poImportDefaultValues', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(False)
);
FCurPrepareOption:=psGetOrderInfo;
DefineProperty('poGetOrderInfo', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(False)
);
FCurPrepareOption:=psSupportUnicodeBlobs;
DefineProperty('poSupportUnicodeBlobs', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=pfSetRequiredFields;
DefineProperty('poSetRequiredFields', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=pfSetReadOnlyFields;
DefineProperty('poSetReadOnlyFields', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=psSQLINT64ToBCD;
DefineProperty('poSQLINT64ToBCD', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=psApplyRepositary;
DefineProperty('poApplyRepositary', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=psAskRecordCount;
DefineProperty('poAskRecordCount', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=psCanEditComputedFields;
DefineProperty('poCanEditComputedFields', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(True)
);
FCurPrepareOption:=psSetEmptyStrToNull;
DefineProperty('poEmptyStrToNull', ReadPrepareOption, WritePrepareOption,
DoSavePrepareOption(False)
);
//
FCurDetailCondition:=dcWaitEndMasterScroll;
DefineProperty('WaitEndMasterScroll', ReadDetailCondition, WriteDetailCondition,
DoSaveDetailCond
);
FCurDetailCondition:=dcForceMasterRefresh;
DefineProperty('dcForceMasterRefresh', ReadDetailCondition, WriteDetailCondition,
DoSaveDetailCond
);
FCurDetailCondition:=dcForceOpen;
DefineProperty('dcForceOpen', ReadDetailCondition, WriteDetailCondition,
DoSaveDetailCond
);
FCurDetailCondition:=dcIgnoreMasterClose;
DefineProperty('dcIgnoreMasterClose', ReadDetailCondition, WriteDetailCondition,
DoSaveDetailCond
);
// Options
FCurOption:=poTrimCharFields;
DefineProperty('oTrimCharFields', ReadOption, WriteOption,
DoSaveOption(False)
);
FCurOption:=poDontCloseAfterEndTransaction;
DefineProperty('oDontAutoClose', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poFreeHandlesAfterClose;
DefineProperty('oFreeHandlesAfterClose', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poUseSelectForLock;
DefineProperty('oUseSelectForLock', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poCacheCalcFields;
DefineProperty('oCacheCalcFields', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poRefreshAfterPost;
DefineProperty('oRefreshAfterPost', ReadOption, WriteOption,
DoSaveOption(False)
);
FCurOption:=poRefreshAfterDelete;
DefineProperty('oRefreshAfterDelete', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poRefreshDeletedRecord;
DefineProperty('oRefreshDeletedRecord', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poStartTransaction;
DefineProperty('oStartTransaction', ReadOption, WriteOption,
DoSaveOption(False)
);
FCurOption:=poAutoFormatFields;
DefineProperty('oAutoFormatFields', ReadOption, WriteOption,
DoSaveOption(False)
);
FCurOption:=poProtectedEdit;
DefineProperty('oProtectedEdit', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poKeepSorting;
DefineProperty('oKeepSorting', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poPersistentSorting;
DefineProperty('oPersistentSorting', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poVisibleRecno;
DefineProperty('oVisibleRecno', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poNoForceIsNull;
DefineProperty('oNoForceIsNull', ReadOption, WriteOption,
DoSaveOption(True)
);
FCurOption:=poFetchAll;
DefineProperty('oFetchAll', ReadOption, WriteOption,
DoSaveOption(True)
);
end ;
Filer.DefineProperty('ObjectView', ReadOV, nil, False );
end;
////End PrepareOptions Stream
{$ENDIF}