OCILIB (C and C++ Driver for Oracle)  4.6.3
ocilib::Number Class Reference

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

#include <ocilib.hpp>

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

Public Member Functions

 Number (bool create=false)
 Create an empty null number object. More...
 
 Number (const otext *str, const otext *format=OTEXT(""))
 Create a Number object with the value provided by the input Number string. More...
 
 Number (const ostring &str, const ostring &format=OTEXT(""))
 Create a Number object with the value provided by the input Number string. More...
 
void FromString (const ostring &str, const ostring &format=OTEXT("")) const
 Assign to the number object the value provided by the input number time string. More...
 
ostring ToString (const ostring &format) const
 Convert the number value to a string using the given format. More...
 
ostring ToString () const override
 Convert the number value to a string using default format OCI_STRING_FORMAT_NUMERIC. More...
 
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 2656 of file ocilib.hpp.

Constructor & Destructor Documentation

◆ Number() [1/3]

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 1786 of file ocilib_impl.hpp.

◆ Number() [2/3]

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 1806 of file ocilib_impl.hpp.

References ocilib::Check(), OCI_NumberCreate(), and OCI_NumberFree().

◆ Number() [3/3]

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 1799 of file ocilib_impl.hpp.

Member Function Documentation

◆ 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 1818 of file ocilib_impl.hpp.

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

◆ 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 1823 of file ocilib_impl.hpp.

References ocilib::Check(), ocilib::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::Streamable.

Definition at line 1839 of file ocilib_impl.hpp.

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