OCILIB (C and C++ Driver for Oracle)  4.7.7
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
ocilib::Number Class Reference

Object identifying the SQL data type NUMBER. More...

#include <types.hpp>

Inherits ocilib::core::HandleHolder< OCI_Number * >, and ocilib::core::Streamable.

Public Member Functions

 Number (bool create=false)
 Create an empty null number object.
 
template<class T , typename core::SupportedNumeric< T >::Type::type * = nullptr>
 Number (const T &value)
 Create a number object initialized with given numerical value.
 
 Number (const Number &other)
 For value types, overrides HandleHolder copy constructor to perform assignment rather than ref counting management.
 
Numberoperator= (const Number &other) noexcept
 For value types, overrides HandleHolder assignment operator to perform assignment rather than ref counting management.
 
 Number (const otext *str, const otext *format=OTEXT(""))
 Create a Number object with the value provided by the input Number string.
 
 Number (const ostring &str, const ostring &format=OTEXT(""))
 Create a Number object with the value provided by the input Number string.
 
void FromString (const ostring &str, const ostring &format=OTEXT("")) const
 Assign to the number object the value provided by the input number time string.
 
ostring ToString (const ostring &format) const
 Convert the number value to a string using the given format.
 
ostring ToString () const override
 Convert the number value to a string using default format OCI_STRING_FORMAT_NUMERIC.
 
Number Clone () const
 Clone the current instance to a new one performing deep copy.
 

Detailed Description

Object identifying the SQL data type NUMBER.

This class wraps the OCILIB object handle OCI_Number and its related methods

NUMBERs can be handled using native scalar types This class is optional and exposes some special NUMBER properties

Definition at line 2506 of file types.hpp.

Constructor & Destructor Documentation

◆ Number() [1/5]

ocilib::Number::Number ( bool  create = false)
inline

Create an empty null number object.

Parameters
create- Indicates if a Oracle Number object must be must be created

Definition at line 28 of file Number.hpp.

◆ Number() [2/5]

template<class T , typename core::SupportedNumeric< T >::Type::type * >
ocilib::Number::Number ( const T &  value)

Create a number object initialized with given numerical value.

Parameters
value- value to assign

Definition at line 37 of file Number.hpp.

◆ Number() [3/5]

ocilib::Number::Number ( const Number other)
inline

For value types, overrides HandleHolder copy constructor to perform assignment rather than ref counting management.

Parameters
other- value to assign

Definition at line 42 of file Number.hpp.

◆ Number() [4/5]

ocilib::Number::Number ( const otext *  str,
const otext *  format = OTEXT("") 
)
inline

Create a Number object with the value provided by the input Number string.

Parameters
str- String Number
format- format of the Number provided in parameter 'data'
Note
For Number formats, refer to the Oracle SQL documentation
Default connection Number format is computed from Environment::GetFormat()

Definition at line 74 of file Number.hpp.

References FromString().

◆ Number() [5/5]

ocilib::Number::Number ( const ostring str,
const ostring format = OTEXT("") 
)
inline

Create a Number object with the value provided by the input Number string.

Parameters
str- String Number
format- format of the Number provided in parameter 'data'
Note
ForNumber formats, refer to the Oracle SQL documentation
Default connection Number format is computed from Environment::GetFormat()

Definition at line 67 of file Number.hpp.

References FromString().

Member Function Documentation

◆ operator=()

Number & ocilib::Number::operator= ( const Number other)
inlinenoexcept

For value types, overrides HandleHolder assignment operator to perform assignment rather than ref counting management.

Parameters
other- value to assign

Definition at line 47 of file Number.hpp.

References ocilib::core::Check(), and OCI_NumberAssign().

◆ FromString()

void ocilib::Number::FromString ( const ostring str,
const ostring format = OTEXT("") 
) const
inline

Assign to the number object the value provided by the input number time string.

Parameters
str- String number time
format- format of the number time provided in parameter 'data'
Note
For number formats, refer to the Oracle SQL documentation
Default connection number format is computed from Environment::GetFormat()

Definition at line 90 of file Number.hpp.

References ocilib::core::Check(), ocilib::FormatNumeric, ocilib::Environment::GetFormat(), and OCI_NumberFromText().

Referenced by Number().

◆ ToString() [1/2]

ostring ocilib::Number::ToString ( const ostring format) const
inline

Convert the number value to a string using the given format.

Parameters
format- number time format to use
Note
For number formats, refer to the Oracle SQL documentation

Definition at line 95 of file Number.hpp.

References ocilib::core::Check(), ocilib::core::MakeString(), and OCI_NumberToText().

◆ ToString() [2/2]

ostring ocilib::Number::ToString ( ) const
inlineoverridevirtual

Convert the number value to a string using default format OCI_STRING_FORMAT_NUMERIC.

Note
For number formats, refer to the Oracle SQL documentation

Implements ocilib::core::Streamable.

Definition at line 111 of file Number.hpp.

References ocilib::FormatNumeric, ocilib::Environment::GetFormat(), and ToString().

Referenced by ToString().

◆ Clone()

Number ocilib::Number::Clone ( ) const
inline

Clone the current instance to a new one performing deep copy.

Definition at line 116 of file Number.hpp.

References ocilib::core::Check(), and OCI_NumberAssign().