23 #include "ocilibcpp/types.hpp"
38 AcquireTransient(pNumber, parent);
55 inline void Number::Allocate()
60 Environment::GetEnvironmentHandle()
73 const size_t size = OCI_SIZE_BUFFER;
82 return OCI_STRING_NULL;
102 AnyPointer Number::GetNativeValue(
const T& value)
104 return reinterpret_cast<AnyPointer>(
const_cast<T*
>(&value));
108 inline AnyPointer Number::GetNativeValue(
const Number& value)
113 inline int Number::Compare(
const Number& other)
const
119 T Number::GetValue()
const
129 Number& Number::SetValue(
const T &value)
142 void Number::Add(
const T &value)
148 void Number::Sub(
const T &value)
154 void Number::Multiply(
const T &value)
160 void Number::Divide(
const T &value)
165 inline Number& Number::operator = (
OCI_Number * &lhs)
170 Environment::GetEnvironmentHandle()
176 template<class T, typename core::SupportedNumeric<T>::Type::type*>
177 Number& Number::operator = (
const T &lhs)
183 template<class T, typename core::SupportedNumeric<T>::Type::type*>
184 Number::operator T()
const
186 return GetValue<T>();
189 template<class T, typename core::SupportedNumeric<T>::Type::type*>
190 Number Number::operator + (
const T &value)
197 template<class T, typename core::SupportedNumeric<T>::Type::type*>
198 Number Number::operator - (
const T &value)
205 template<class T, typename core::SupportedNumeric<T>::Type::type*>
206 Number Number::operator * (
const T &value)
209 result.Multiply(value);
213 template<class T, typename core::SupportedNumeric<T>::Type::type*>
214 Number Number::operator / (
const T &value)
217 result.Divide(value);
221 template<class T, typename core::SupportedNumeric<T>::Type::type*>
222 Number& Number::operator += (
const T &value)
228 template<class T, typename core::SupportedNumeric<T>::Type::type*>
229 Number& Number::operator -= (
const T &value)
235 template<class T, typename core::SupportedNumeric<T>::Type::type*>
236 Number& Number::operator *= (
const T &value)
242 template<class T, typename core::SupportedNumeric<T>::Type::type*>
243 Number& Number::operator /= (
const T &value)
249 inline Number& Number::operator ++ ()
254 inline Number& Number::operator -- ()
259 inline Number Number::operator ++ (
int)
264 inline Number Number::operator -- (
int)
269 inline bool Number::operator == (
const Number& other)
const
271 return Compare(other) == 0;
274 inline bool Number::operator != (
const Number& other)
const
276 return !(*
this == other);
279 inline bool Number::operator > (
const Number& other)
const
281 return Compare(other) > 0;
284 inline bool Number::operator < (
const Number& other)
const
286 return Compare(other) < 0;
289 inline bool Number::operator >= (
const Number& other)
const
291 const int res = Compare(other);
293 return res == 0 || res < 0;
296 inline bool Number::operator <= (
const Number& other)
const
298 const int res = Compare(other);
300 return res == 0 || res > 0;
static ostring GetFormat(FormatType formatType)
Return the format string for implicit string conversions of the given type.
Object identifying the SQL data type NUMBER.
Number Clone() const
Clone the current instance to a new one performing deep copy.
ostring ToString() const override
Convert the number value to a string using default format OCI_STRING_FORMAT_NUMERIC.
Number(bool create=false)
Create an empty null number object.
void FromString(const ostring &str, const ostring &format=OTEXT("")) const
Assign to the number object the value provided by the input number time string.
Internal usage. Interface for handling ownership and relationship of a C API handle.
Internal usage. Provide a buffer class with RAII capabilities.
struct OCI_Number OCI_Number
Oracle NUMBER representation.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberSetValue(OCI_Number *number, unsigned int type, void *value)
Assign the number value with the value of a native C numeric type.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberSub(OCI_Number *number, unsigned int type, void *value)
Subtract the value of a native C numeric type to the given number.
OCI_SYM_PUBLIC int OCI_API OCI_NumberCompare(OCI_Number *number1, OCI_Number *number2)
Compares two number handles.
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_NumberCreate(OCI_Connection *con)
Create a local number object.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberMultiply(OCI_Number *number, unsigned int type, void *value)
Multiply the given number with the value of a native C numeric.
OCI_SYM_PUBLIC unsigned char *OCI_API OCI_NumberGetContent(OCI_Number *number)
Return the number value content.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberDivide(OCI_Number *number, unsigned int type, void *value)
Divide the given number with the value of a native C numeric.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberFromText(OCI_Number *number, const otext *str, const otext *fmt)
Convert a string to a number and store it in the given number handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberAdd(OCI_Number *number, unsigned int type, void *value)
Add the value of a native C numeric type to the given number.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberToText(OCI_Number *number, const otext *fmt, int size, otext *str)
Convert a number value from the given number handle to a string.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberGetValue(OCI_Number *number, unsigned int type, void *value)
Assign the number value to a native C numeric type.
OCI_SYM_PUBLIC int OCI_API OCI_NumberAssign(OCI_Number *number, OCI_Number *number_src)
Assign the value of a number handle to another one.
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so,...
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
std::basic_string< otext, std::char_traits< otext >, std::allocator< otext > > ostring
string class wrapping the OCILIB otext * type and OTEXT() macros ( see Character sets )
void * AnyPointer
Alias for the generic void pointer.