2 * Copyright (C) 2004, Leo Seib, Hannover
4 * Project:Dataset C++ Dynamic Library
5 * Module: FieldValue class and result sets classes header file
6 * Author: Leo Seib E-Mail: leoseib@web.de
9 * SPDX-License-Identifier: MIT
10 * See LICENSES/README.md for more information.
41 #ifdef TARGET_WINDOWS_STORE
50 std::string str_value
;
56 unsigned short ushort_value
;
58 unsigned int uint_value
;
69 explicit field_value(const char* s
);
70 explicit field_value(const bool b
);
71 explicit field_value(const char c
);
72 explicit field_value(const short s
);
73 explicit field_value(const unsigned short us
);
74 explicit field_value(const int l
);
75 explicit field_value(const unsigned int ul
);
76 explicit field_value(const float f
);
77 explicit field_value(const double d
);
78 explicit field_value(const int64_t i
);
79 field_value(const char* s
, std::size_t len
);
80 field_value(const field_value
& fv
);
81 field_value(field_value
&& fv
) noexcept
;
84 fType
get_fType() const { return field_type
; }
85 bool get_isNull() const { return is_null
; }
86 std::string
get_asString() const&;
87 std::string
get_asString() &&;
88 bool get_asBool() const;
89 char get_asChar() const;
90 short get_asShort() const;
91 unsigned short get_asUShort() const;
92 int get_asInt() const;
93 unsigned int get_asUInt() const;
94 float get_asFloat() const;
95 double get_asDouble() const;
96 int64_t get_asInt64() const;
98 field_value
& operator=(const char* s
)
103 field_value
& operator=(const std::string
& s
)
108 field_value
& operator=(std::string
&& s
)
110 set_asString(std::move(s
));
113 field_value
& operator=(const bool b
)
118 field_value
& operator=(const short s
)
123 field_value
& operator=(const unsigned short us
)
128 field_value
& operator=(const int l
)
133 field_value
& operator=(const unsigned int l
)
138 field_value
& operator=(const float f
)
143 field_value
& operator=(const double d
)
148 field_value
& operator=(const int64_t i
)
153 field_value
& operator=(const field_value
& fv
);
154 field_value
& operator=(field_value
&& fv
) noexcept
;
157 friend std::ostream
& operator<<(std::ostream
& os
, const field_value
& fv
)
159 switch (fv
.get_fType())
163 return os
<< fv
.get_asString();
168 return os
<< fv
.get_asBool();
173 return os
<< fv
.get_asChar();
178 return os
<< fv
.get_asShort();
183 return os
<< fv
.get_asUShort();
188 return os
<< fv
.get_asInt();
193 return os
<< fv
.get_asUInt();
198 return os
<< fv
.get_asFloat();
203 return os
<< fv
.get_asDouble();
208 return os
<< fv
.get_asInt64();
219 void set_isNull() { is_null
= true; }
220 void set_asString(const char* s
);
221 void set_asString(const char* s
, std::size_t len
);
222 void set_asString(const std::string
& s
);
223 void set_asString(std::string
&& s
);
224 void set_asBool(const bool b
);
225 void set_asChar(const char c
);
226 void set_asShort(const short s
);
227 void set_asUShort(const unsigned short us
);
228 void set_asInt(const int l
);
229 void set_asUInt(const unsigned int l
);
230 void set_asFloat(const float f
);
231 void set_asDouble(const double d
);
232 void set_asInt64(const int64_t i
);
234 fType
get_field_type();
249 typedef std::vector
<field
> Fields
;
250 typedef std::vector
<field_value
> sql_record
;
251 typedef std::vector
<field_prop
> record_prop
;
252 typedef std::vector
<sql_record
*> query_data
;
253 typedef field_value variant
;
258 result_set() = default;
259 ~result_set() { clear(); };
262 for (unsigned int i
= 0; i
< records
.size(); i
++)
266 record_header
.clear();
269 record_prop record_header
;
273 #ifdef TARGET_WINDOWS_STORE
276 } // namespace dbiplus