kernel/qsqlfield.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4class QSqlFieldPrivate -
5{ -
6public: -
7 QSqlFieldPrivate(const QString &name, -
8 QVariant::Type type) : -
9 ref(1), nm(name), ro(false), type(type), req(QSqlField::Unknown), -
10 len(-1), prec(-1), tp(-1), gen(true), autoval(false) -
11 { -
12 }
executed: }
Execution Count:6131
6131
13 -
14 QSqlFieldPrivate(const QSqlFieldPrivate &other) -
15 : ref(1), -
16 nm(other.nm), -
17 ro(other.ro), -
18 type(other.type), -
19 req(other.req), -
20 len(other.len), -
21 prec(other.prec), -
22 def(other.def), -
23 tp(other.tp), -
24 gen(other.gen), -
25 autoval(other.autoval) -
26 {}
executed: }
Execution Count:1071
1071
27 -
28 bool operator==(const QSqlFieldPrivate& other) const -
29 { -
30 return (nm == other.nm 569
31 && ro == other.ro 569
32 && type == other.type 569
33 && req == other.req 569
34 && len == other.len 569
35 && prec == other.prec 569
36 && def == other.def 569
37 && gen == other.gen 569
38 && autoval == other.autoval);
executed: return (nm == other.nm && ro == other.ro && type == other.type && req == other.req && len == other.len && prec == other.prec && def == other.def && gen == other.gen && autoval == other.autoval);
Execution Count:569
569
39 } -
40 -
41 QAtomicInt ref; -
42 QString nm; -
43 uint ro: 1; -
44 QVariant::Type type; -
45 QSqlField::RequiredStatus req; -
46 int len; -
47 int prec; -
48 QVariant def; -
49 int tp; -
50 uint gen: 1; -
51 uint autoval: 1; -
52}; -
53QSqlField::QSqlField(const QString& fieldName, QVariant::Type type) -
54{ -
55 d = new QSqlFieldPrivate(fieldName, type); -
56 val = QVariant(type); -
57}
executed: }
Execution Count:6131
6131
58 -
59 -
60 -
61 -
62 -
63QSqlField::QSqlField(const QSqlField& other) -
64{ -
65 d = other.d; -
66 d->ref.ref(); -
67 val = other.val; -
68}
executed: }
Execution Count:31252
31252
69 -
70 -
71 -
72 -
73 -
74QSqlField& QSqlField::operator=(const QSqlField& other) -
75{ -
76 qAtomicAssign(d, other.d); -
77 val = other.val; -
78 return *this;
executed: return *this;
Execution Count:233
233
79} -
80bool QSqlField::operator==(const QSqlField& other) const -
81{ -
82 return ((d == other.d || *d == *other.d) 595
83 && val == other.val);
executed: return ((d == other.d || *d == *other.d) && val == other.val);
Execution Count:595
595
84} -
85 -
86 -
87 -
88 -
89 -
90QSqlField::~QSqlField() -
91{ -
92 if (!d->ref.deref())
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:7085
yes
Evaluation Count:30298
7085-30298
93 delete d;
executed: delete d;
Execution Count:7085
7085
94}
executed: }
Execution Count:37383
37383
95 -
96 -
97 -
98 -
99 -
100 -
101 -
102void QSqlField::setRequiredStatus(RequiredStatus required) -
103{ -
104 detach(); -
105 d->req = required; -
106}
executed: }
Execution Count:967
967
107void QSqlField::setLength(int fieldLength) -
108{ -
109 detach(); -
110 d->len = fieldLength; -
111}
executed: }
Execution Count:3
3
112 -
113 -
114 -
115 -
116 -
117 -
118 -
119void QSqlField::setPrecision(int precision) -
120{ -
121 detach(); -
122 d->prec = precision; -
123}
executed: }
Execution Count:3
3
124 -
125 -
126 -
127 -
128 -
129 -
130 -
131void QSqlField::setDefaultValue(const QVariant &value) -
132{ -
133 detach(); -
134 d->def = value; -
135}
executed: }
Execution Count:964
964
136 -
137 -
138 -
139 -
140void QSqlField::setSqlType(int type) -
141{ -
142 detach(); -
143 d->tp = type; -
144}
executed: }
Execution Count:4547
4547
145void QSqlField::setGenerated(bool gen) -
146{ -
147 detach(); -
148 d->gen = gen; -
149}
executed: }
Execution Count:1702
1702
150void QSqlField::setValue(const QVariant& value) -
151{ -
152 if (isReadOnly())
evaluated: isReadOnly()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1527
4-1527
153 return;
executed: return;
Execution Count:4
4
154 val = value; -
155}
executed: }
Execution Count:1527
1527
156void QSqlField::clear() -
157{ -
158 if (isReadOnly())
evaluated: isReadOnly()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:129
14-129
159 return;
executed: return;
Execution Count:14
14
160 val = QVariant(type()); -
161}
executed: }
Execution Count:129
129
162 -
163 -
164 -
165 -
166 -
167 -
168 -
169void QSqlField::setName(const QString& name) -
170{ -
171 detach(); -
172 d->nm = name; -
173}
executed: }
Execution Count:7
7
174 -
175 -
176 -
177 -
178 -
179 -
180void QSqlField::setReadOnly(bool readOnly) -
181{ -
182 detach(); -
183 d->ro = readOnly; -
184}
executed: }
Execution Count:32
32
185QString QSqlField::name() const -
186{ -
187 return d->nm;
executed: return d->nm;
Execution Count:4380
4380
188} -
189QVariant::Type QSqlField::type() const -
190{ -
191 return d->type;
executed: return d->type;
Execution Count:307
307
192} -
193 -
194 -
195 -
196 -
197 -
198 -
199 -
200void QSqlField::setType(QVariant::Type type) -
201{ -
202 detach(); -
203 d->type = type; -
204 if (!val.isValid())
never evaluated: !val.isValid()
0
205 val = QVariant(type);
never executed: val = QVariant(type);
0
206}
never executed: }
0
207bool QSqlField::isReadOnly() const -
208{ return d->ro; }
executed: return d->ro;
Execution Count:1943
1943
209 -
210 -
211 -
212 -
213 -
214 -
215 -
216bool QSqlField::isNull() const -
217{ return val.isNull(); }
executed: return val.isNull();
Execution Count:558
558
218 -
219 -
220 -
221void QSqlField::detach() -
222{ -
223 qAtomicDetach(d); -
224}
executed: }
Execution Count:8246
8246
225QSqlField::RequiredStatus QSqlField::requiredStatus() const -
226{ -
227 return d->req;
executed: return d->req;
Execution Count:3
3
228} -
229int QSqlField::length() const -
230{ -
231 return d->len;
executed: return d->len;
Execution Count:3
3
232} -
233int QSqlField::precision() const -
234{ -
235 return d->prec;
executed: return d->prec;
Execution Count:3
3
236} -
237 -
238 -
239 -
240 -
241 -
242 -
243 -
244QVariant QSqlField::defaultValue() const -
245{ -
246 return d->def;
never executed: return d->def;
0
247} -
248int QSqlField::typeID() const -
249{ -
250 return d->tp;
never executed: return d->tp;
0
251} -
252bool QSqlField::isGenerated() const -
253{ -
254 return d->gen;
executed: return d->gen;
Execution Count:8263
8263
255} -
256 -
257 -
258 -
259 -
260 -
261bool QSqlField::isValid() const -
262{ -
263 return d->type != QVariant::Invalid;
executed: return d->type != QVariant::Invalid;
Execution Count:373
373
264} -
265 -
266 -
267QDebug operator<<(QDebug dbg, const QSqlField &f) -
268{ -
269 dbg.nospace() << "QSqlField(" << f.name() << ", " << QMetaType::typeName(f.type()); -
270 if (f.length() >= 0)
never evaluated: f.length() >= 0
0
271 dbg.nospace() << ", length: " << f.length();
never executed: dbg.nospace() << ", length: " << f.length();
0
272 if (f.precision() >= 0)
never evaluated: f.precision() >= 0
0
273 dbg.nospace() << ", precision: " << f.precision();
never executed: dbg.nospace() << ", precision: " << f.precision();
0
274 if (f.requiredStatus() != QSqlField::Unknown)
never evaluated: f.requiredStatus() != QSqlField::Unknown
0
275 dbg.nospace() << ", required: " 0
276 << (f.requiredStatus() == QSqlField::Required ? "yes" : "no");
never executed: dbg.nospace() << ", required: " << (f.requiredStatus() == QSqlField::Required ? "yes" : "no");
0
277 dbg.nospace() << ", generated: " << (f.isGenerated() ? "yes" : "no"); -
278 if (f.typeID() >= 0)
never evaluated: f.typeID() >= 0
0
279 dbg.nospace() << ", typeID: " << f.typeID();
never executed: dbg.nospace() << ", typeID: " << f.typeID();
0
280 if (!f.defaultValue().isNull())
never evaluated: !f.defaultValue().isNull()
0
281 dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"';
never executed: dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"';
0
282 dbg.nospace() << ')'; -
283 return dbg.space();
never executed: return dbg.space();
0
284} -
285bool QSqlField::isAutoValue() const -
286{ -
287 return d->autoval;
executed: return d->autoval;
Execution Count:460
460
288} -
289 -
290 -
291 -
292 -
293 -
294 -
295 -
296void QSqlField::setAutoValue(bool autoVal) -
297{ -
298 detach(); -
299 d->autoval = autoVal; -
300}
executed: }
Execution Count:21
21
301 -
302 -
303 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial