|
Lightweight 0.20260303.0
|
#include <SqlNumeric.hpp>
Public Member Functions | |
| constexpr | SqlNumeric () noexcept=default |
| Default constructor. | |
| constexpr | SqlNumeric (SqlNumeric &&) noexcept=default |
| Move constructor. | |
| constexpr SqlNumeric & | operator= (SqlNumeric &&) noexcept=default |
| Move assignment operator. | |
| constexpr | SqlNumeric (SqlNumeric const &) noexcept=default |
| Copy constructor. | |
| constexpr SqlNumeric & | operator= (SqlNumeric const &) noexcept=default |
| Copy assignment operator. | |
| constexpr | SqlNumeric (std::floating_point auto value) noexcept |
| Constructs a numeric from a floating point value. | |
| constexpr | SqlNumeric (SQL_NUMERIC_STRUCT const &value) noexcept |
| Constructs a numeric from a SQL_NUMERIC_STRUCT. | |
| LIGHTWEIGHT_FORCE_INLINE constexpr void | assign (std::floating_point auto inputValue) noexcept |
| Assigns a value to the numeric. | |
| LIGHTWEIGHT_FORCE_INLINE constexpr SqlNumeric & | operator= (std::floating_point auto value) noexcept |
| Assigns a floating point value to the numeric. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE auto | ToUnscaledValue () const noexcept |
| Converts the numeric to an unscaled integer value. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE float | ToFloat () const noexcept |
| Converts the numeric to a floating point value. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE double | ToDouble () const noexcept |
| Converts the numeric to a double precision floating point value. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE long double | ToLongDouble () const noexcept |
| Converts the numeric to a long double precision floating point value. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE | operator float () const noexcept |
| Converts the numeric to a floating point value. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE | operator double () const noexcept |
| Converts the numeric to a double precision floating point value. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE | operator long double () const noexcept |
| Converts the numeric to a long double precision floating point value. | |
| LIGHTWEIGHT_FORCE_INLINE std::string | ToString () const |
| Converts the numeric to a string. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::weak_ordering | operator<=> (SqlNumeric const &other) const noexcept |
| Three-way comparison operator. | |
| template<std::size_t OtherPrecision, std::size_t OtherScale> | |
| constexpr LIGHTWEIGHT_FORCE_INLINE bool | operator== (SqlNumeric< OtherPrecision, OtherScale > const &other) const noexcept |
| Equality comparison operator. | |
Public Attributes | |
| SQL_NUMERIC_STRUCT | sqlValue {} |
| The SQL numeric struct for ODBC binding. | |
| double | nativeValue {} |
| Cached native value for drivers without SQL_NUMERIC_STRUCT support. | |
Static Public Attributes | |
| static constexpr auto | Precision = ThePrecision |
| Number of total digits. | |
| static constexpr auto | Scale = TheScale |
| Number of digits after the decimal point. | |
| static constexpr auto | ColumnType = SqlColumnTypeDefinitions::Decimal { .precision = Precision, .scale = TheScale } |
| The SQL column type definition for this numeric type. | |
Represents a fixed-point number with a given precision and scale.
Precision is exactly the total number of digits in the number, including the digits after the decimal point.
Scale is the number of digits after the decimal point.
Definition at line 38 of file SqlNumeric.hpp.
|
inlineconstexprnoexcept |
Constructs a numeric from a floating point value.
Definition at line 71 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::assign().
|
inlineexplicitconstexprnoexcept |
Constructs a numeric from a SQL_NUMERIC_STRUCT.
Definition at line 77 of file SqlNumeric.hpp.
|
inlineconstexprnoexcept |
Assigns a value to the numeric.
Definition at line 86 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::nativeValue, Lightweight::SqlNumeric< ThePrecision, TheScale >::Precision, Lightweight::SqlNumeric< ThePrecision, TheScale >::Scale, and Lightweight::SqlNumeric< ThePrecision, TheScale >::sqlValue.
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::operator=(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::SqlNumeric().
|
inlineconstexprnoexcept |
Assigns a floating point value to the numeric.
Definition at line 106 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::assign().
|
inlineconstexprnoexcept |
Converts the numeric to an unscaled integer value.
Definition at line 113 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::nativeValue, Lightweight::SqlNumeric< ThePrecision, TheScale >::Scale, and Lightweight::SqlNumeric< ThePrecision, TheScale >::sqlValue.
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::ToDouble(), Lightweight::SqlNumeric< ThePrecision, TheScale >::ToFloat(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToLongDouble().
|
inlineconstexprnoexcept |
Converts the numeric to a floating point value.
Definition at line 134 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::sqlValue, and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::operator float(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::operator==().
|
inlineconstexprnoexcept |
Converts the numeric to a double precision floating point value.
Definition at line 140 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::sqlValue, and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::operator double(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::operator<=>().
|
inlineconstexprnoexcept |
Converts the numeric to a long double precision floating point value.
Definition at line 146 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::sqlValue, and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::operator long double(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToString().
|
inlineexplicitconstexprnoexcept |
Converts the numeric to a floating point value.
Definition at line 152 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::ToFloat().
|
inlineexplicitconstexprnoexcept |
Converts the numeric to a double precision floating point value.
Definition at line 158 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::ToDouble().
|
inlineexplicitconstexprnoexcept |
Converts the numeric to a long double precision floating point value.
Definition at line 164 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::ToLongDouble().
|
inline |
Converts the numeric to a string.
Definition at line 170 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::Scale, and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToLongDouble().
|
inlineconstexprnoexcept |
Three-way comparison operator.
Definition at line 176 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::ToDouble().
|
inlineconstexprnoexcept |
Equality comparison operator.
Definition at line 183 of file SqlNumeric.hpp.
References Lightweight::SqlNumeric< ThePrecision, TheScale >::ToFloat().
|
staticconstexpr |
Number of total digits.
Definition at line 41 of file SqlNumeric.hpp.
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::assign().
|
staticconstexpr |
Number of digits after the decimal point.
Definition at line 44 of file SqlNumeric.hpp.
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::assign(), Lightweight::SqlNumeric< ThePrecision, TheScale >::ToString(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
|
staticconstexpr |
The SQL column type definition for this numeric type.
Definition at line 47 of file SqlNumeric.hpp.
| SQL_NUMERIC_STRUCT Lightweight::SqlNumeric< ThePrecision, TheScale >::sqlValue {} |
The SQL numeric struct for ODBC binding.
Definition at line 53 of file SqlNumeric.hpp.
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::assign(), Lightweight::SqlNumeric< ThePrecision, TheScale >::ToDouble(), Lightweight::SqlNumeric< ThePrecision, TheScale >::ToFloat(), Lightweight::SqlNumeric< ThePrecision, TheScale >::ToLongDouble(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
| double Lightweight::SqlNumeric< ThePrecision, TheScale >::nativeValue {} |
Cached native value for drivers without SQL_NUMERIC_STRUCT support.
Definition at line 56 of file SqlNumeric.hpp.
Referenced by Lightweight::SqlNumeric< ThePrecision, TheScale >::assign(), and Lightweight::SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().