-
Notifications
You must be signed in to change notification settings - Fork 58
/
FIBQueryPT.inc
168 lines (133 loc) · 4.68 KB
/
FIBQueryPT.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
{***************************************************************}
{ 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}
FLoadingPrepared:boolean;
procedure ReadQueryStartTransaction (Reader: TReader);
procedure WriteQueryStartTransaction(Writer: TWriter);
procedure ReadQueryAutoCommit (Reader: TReader);
procedure WriteQueryAutoCommit(Writer: TWriter);
procedure ReadQueryTrimChar (Reader: TReader);
procedure WriteQueryTrimChar(Writer: TWriter);
procedure ReadAutoFreeHandle (Reader: TReader);
procedure WriteAutoFreeHandle(Writer: TWriter);
procedure ReadQueryNoForceIsNull (Reader: TReader);
procedure WriteQueryNoForceIsNull(Writer: TWriter);
procedure DefineProperties(Filer: TFiler); override;
{$ENDIF}
{$IFDEF FIB_IMPLEMENT}
procedure TFIBQuery.ReadQueryTrimChar (Reader: TReader);
begin
if Reader.ReadBoolean then
Include(FOptions,qoTrimCharFields)
else
Exclude(FOptions,qoTrimCharFields)
end;
procedure TFIBQuery.WriteQueryTrimChar(Writer: TWriter);
begin
Writer.WriteBoolean(qoTrimCharFields in Options);
end;
procedure TFIBQuery.ReadQueryStartTransaction (Reader: TReader);
begin
if Reader.ReadBoolean then
Include(FOptions,qoStartTransaction)
else
Exclude(FOptions,qoStartTransaction);
end;
procedure TFIBQuery.WriteQueryStartTransaction(Writer: TWriter);
begin
Writer.WriteBoolean(qoStartTransaction in Options)
end;
procedure TFIBQuery.ReadQueryAutoCommit (Reader: TReader);
begin
if Reader.ReadBoolean then
Include(FOptions,qoAutoCommit)
else
Exclude(FOptions,qoAutoCommit)
end;
procedure TFIBQuery.WriteQueryAutoCommit(Writer: TWriter);
begin
Writer.WriteBoolean(qoAutoCommit in Options)
end;
procedure TFIBQuery.ReadAutoFreeHandle (Reader: TReader);
begin
if Reader.ReadBoolean then
Include(FOptions,qoFreeHandleAfterExecute)
else
Exclude(FOptions,qoFreeHandleAfterExecute);
end;
procedure TFIBQuery.WriteAutoFreeHandle(Writer: TWriter);
begin
Writer.WriteBoolean(qoFreeHandleAfterExecute in Options)
end;
procedure TFIBQuery.ReadQueryNoForceIsNull (Reader: TReader);
begin
if Reader.ReadBoolean then
Include(FOptions,qoNoForceIsNull)
else
Exclude(FOptions,qoNoForceIsNull);
end;
procedure TFIBQuery.WriteQueryNoForceIsNull(Writer: TWriter);
begin
Writer.WriteBoolean(qoNoForceIsNull in Options)
end;
procedure TFIBQuery.DefineProperties(Filer: TFiler);
var
IsWriteProcess:boolean;
function DoSave(Option:TpFIBQueryOption):boolean;
begin
if Filer.Ancestor <> nil then
begin
Result:=([Option]*TFIBQuery(Filer.Ancestor).Options)<>([Option]*Options)
end
else
Result:= Option in Options
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:=[];
FLoadingPrepared:=True;
end;
Filer.DefineProperty('qoAutoCommit',
ReadQueryAutoCommit, WriteQueryAutoCommit,
IsWriteProcess and DoSave(qoAutoCommit)
);
Filer.DefineProperty('qoStartTransaction',
ReadQueryStartTransaction, WriteQueryStartTransaction,
IsWriteProcess and DoSave(qoStartTransaction)
);
Filer.DefineProperty('qoTrimCharFields',
ReadQueryTrimChar , WriteQueryTrimChar,
IsWriteProcess and DoSave(qoTrimCharFields)
);
Filer.DefineProperty('qoNoForceIsNull',
ReadQueryNoForceIsNull, WriteQueryNoForceIsNull,
IsWriteProcess and DoSave(qoNoForceIsNull)
);
Filer.DefineProperty('qoFreeHandleAfterExecute',
ReadAutoFreeHandle , WriteAutoFreeHandle,
IsWriteProcess and DoSave(qoFreeHandleAfterExecute)
);
end;
{$ENDIF}