Go to the documentation of this file.
32 #ifndef MYSQLPP_NULL_H
33 #define MYSQLPP_NULL_H
49 class MYSQLPP_EXPORT null_type
52 #if !defined(DOXYGEN_IGNORE)
54 template <
typename CannotConvertNullToAnyOtherDataType>
55 operator CannotConvertNullToAnyOtherDataType()
const
57 return CannotConvertNullToAnyOtherDataType();
59 #endif // !defined(DOXYGEN_IGNORE)
84 const null_type
null = null_type();
96 #if !defined(DOXYGEN_IGNORE)
98 static null_type null_is() {
return null; }
100 static std::ostream& null_ostr(std::ostream& o)
105 #endif // !defined(DOXYGEN_IGNORE)
117 #if !defined(DOXYGEN_IGNORE)
119 static int null_is() {
return 0; }
121 static std::ostream& null_ostr(std::ostream& o)
126 #endif // !defined(DOXYGEN_IGNORE)
137 #if !defined(DOXYGEN_IGNORE)
139 static const char *null_is() {
return ""; }
141 static std::ostream& null_ostr(std::ostream& o)
146 #endif // !defined(DOXYGEN_IGNORE)
169 template <
class Type,
class Behavior = NullIsNull>
202 Null(
const Type& x) :
229 operator Type()
const
232 return Behavior::null_is();
269 else if (
is_null != rhs.is_null) {
273 return data == rhs.data;
284 {
return !(*
this == rhs); }
288 {
return !(*
this == rhs); }
300 else if (rhs.is_null) {
304 return data < rhs.data;
312 bool operator <(
const null_type&)
const {
return false; }
316 #if !defined(DOXYGEN_IGNORE)
320 template <>
class Null<void>
343 #endif // !defined(DOXYGEN_IGNORE)
349 template <
class Type,
class Behavior>
350 inline std::ostream& operator <<(std::ostream& o,
351 const Null<Type, Behavior>& n)
354 return Behavior::null_ostr(o);
Class for objects that define SQL null as a blank C string.
Definition: null.h:157
Declares the MySQL++-specific exception classes.
Type data
The object's value, when it is not SQL null.
Definition: null.h:196
Null & operator=(const Type &x)
Assign a value to the object.
Definition: null.h:264
bool operator==(const Null< Type > &rhs) const
Do equality comparison of two nullable values.
Definition: null.h:286
The type of the global mysqlpp::null object.
Definition: null.h:71
Declares classes that implement SQL "null" semantics within C++'s type system.
bool operator<(const Null< Type > &rhs) const
Do less-than comparison of two nullable values.
Definition: null.h:317
const std::string null_str
"NULL" string constant
Class for holding data from a SQL column with the NULL attribute.
Definition: null.h:192
Null()
Default constructor.
Definition: null.h:211
bool operator!=(const Null< Type > &rhs) const
Do inequality comparison of two nullable values.
Definition: null.h:305
Type value_type
Type of the data stored in this object, when it is not equal to SQL null.
Definition: null.h:205
bool is_null
If set, this object is considered equal to SQL null.
Definition: null.h:201