Public Member Functions | Protected Attributes

OCIPL::SqlNumber Struct Reference

wrapper for internal Oracle NUMBER type More...

#include <ocipl.h>

Inheritance diagram for OCIPL::SqlNumber:
Inheritance graph
[legend]
Collaboration diagram for OCIPL::SqlNumber:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SqlNumber ()
 SqlNumber (const oraclenumber *pnum)
 SqlNumber (OCIError *errh, const TCHAR *s, const TCHAR *fmt=TEXT("99999999999999999999999999999999999999D99999999999999999999"), const TCHAR *nls_fmt=TEXT("NLS_NUMERIC_CHARACTERS='.,'"))
 SqlNumber (OCIError *errh, double d)
 SqlNumber (OCIError *errh, double d, OCIInd ind)
 SqlNumber (OCIError *errh, int i)
 SqlNumber (OCIError *errh, int i, OCIInd ind)
 SqlNumber (ub1 *num_ptr, ub1 num_len)
const oraclenumberget_number () const
oraclenumberget_ref ()
const oraclenumberget_ptr () const
tstring str (OCIError *errh, const TCHAR *fmt=TEXT("TM9"), const TCHAR *nls_fmt=TEXT("NLS_NUMERIC_CHARACTERS='.,'")) const
 operator OCINumber * ()
 operator const OCINumber * () const
int get_int (OCIError *errh, int null=INT_NULL) const
double get_double (OCIError *errh, double null=0.) const
bool is_null () const
bool is_not_null () const
const SqlIndind () const
SqlIndind ()

Protected Attributes

oraclenumber _val
SqlInd _ind

Detailed Description

wrapper for internal Oracle NUMBER type

Definition at line 1792 of file ocipl.h.


Constructor & Destructor Documentation

OCIPL::SqlNumber::SqlNumber (  ) [inline]

Definition at line 1794 of file ocipl.h.

{}
OCIPL::SqlNumber::SqlNumber ( const oraclenumber pnum )

Definition at line 498 of file ocipl.cpp.

References OCIPL::SqlValue::_ind, _val, OCIPL::oraclenumber::exp, OCIPL::oraclenumber::len, and OCIPL::SqlInd::set().

{
    memcpy(&_val.exp, &pnum->exp, pnum->len);
    _val.len = pnum->len;
    _ind.set();
}

Here is the call graph for this function:

OCIPL::SqlNumber::SqlNumber ( OCIError *  errh,
const TCHAR *  s,
const TCHAR *  fmt = TEXT("99999999999999999999999999999999999999D99999999999999999999"),
const TCHAR *  nls_fmt = TEXT("NLS_NUMERIC_CHARACTERS='.,'") 
)

Definition at line 505 of file ocipl.cpp.

References OCIPL::SqlValue::_ind, _tcslen, _val, OCIPL::SqlInd::clear(), OCIPL::istspace(), OCIPL::oci_check_error(), OCIPL::SqlInd::set(), and str().

{
    if (str) {
        while(istspace(*str))
            ++str;

        if (*str) {
            sword res = OCINumberFromText(errh,
                                (const OraText*)str, (ub4)_tcslen(str)*sizeof(TOraText),
                                (const OraText*)fmt, (ub4)_tcslen(fmt)*sizeof(TOraText),
                                (const OraText*)nls_fmt, (ub4)_tcslen(nls_fmt)*sizeof(TOraText),
                                (OCINumber*)&_val);

            oci_check_error(errh, res);

            _ind.set();
        } else
        _ind.clear();
    } else
        _ind.clear();
}

Here is the call graph for this function:

OCIPL::SqlNumber::SqlNumber ( OCIError *  errh,
double  d 
) [inline]

Definition at line 1802 of file ocipl.h.

References OCIPL::oci_check_error().

    {
        sword res = OCINumberFromReal(errh, &d, sizeof(d), (OCINumber*)&_val);
        oci_check_error(errh, res);
        _ind.set();
    }

Here is the call graph for this function:

OCIPL::SqlNumber::SqlNumber ( OCIError *  errh,
double  d,
OCIInd  ind 
) [inline]

Definition at line 1810 of file ocipl.h.

References OCIPL::oci_check_error().

     :  SqlValue(ind)
    {
        if (ind != OCI_IND_NULL) {
            sword res = OCINumberFromReal(errh, &d, sizeof(d), (OCINumber*)&_val);
            oci_check_error(errh, res);
        }
    }

Here is the call graph for this function:

OCIPL::SqlNumber::SqlNumber ( OCIError *  errh,
int  i 
) [inline]

Definition at line 1819 of file ocipl.h.

References OCIPL::oci_check_error().

    {
        sword res = OCINumberFromInt(errh, &i, sizeof(i), OCI_NUMBER_SIGNED, (OCINumber*)&_val);
        oci_check_error(errh, res);
        _ind.set();
    }

Here is the call graph for this function:

OCIPL::SqlNumber::SqlNumber ( OCIError *  errh,
int  i,
OCIInd  ind 
) [inline]

Definition at line 1827 of file ocipl.h.

References OCIPL::oci_check_error().

     :  SqlValue(ind)
    {
        if (ind != OCI_IND_NULL) {
            sword res = OCINumberFromInt(errh, &i, sizeof(i), OCI_NUMBER_SIGNED, (OCINumber*)&_val);
            oci_check_error(errh, res);
        }
    }

Here is the call graph for this function:

OCIPL::SqlNumber::SqlNumber ( ub1 *  num_ptr,
ub1  num_len 
) [inline]

Definition at line 1836 of file ocipl.h.

    {
        memcpy(&_val.exp, num_ptr, num_len);
        _val.len = num_len;
        _ind.set();
    }

Member Function Documentation

double OCIPL::SqlNumber::get_double ( OCIError *  errh,
double  null = 0. 
) const [inline]

Definition at line 1879 of file ocipl.h.

References OCIPL::number_to_double().

    {
        if (is_null())
            return null;
        else
            return number_to_double(_val, errh);    // atof(str(true).c_str());
    }

Here is the call graph for this function:

int OCIPL::SqlNumber::get_int ( OCIError *  errh,
int  null = INT_NULL 
) const [inline]

Definition at line 1861 of file ocipl.h.

References OCIPL::number_to_int().

    {
        if (is_null())
            return null;
        else
            return number_to_int(_val, errh);
    }

Here is the call graph for this function:

const oraclenumber& OCIPL::SqlNumber::get_number (  ) const [inline]

Definition at line 1843 of file ocipl.h.

Referenced by OCIPL::ResultIterator::get_number(), and OCIPL::SqlNumberArray::set_number().

{return _val;}

Here is the caller graph for this function:

const oraclenumber* OCIPL::SqlNumber::get_ptr (  ) const [inline]

Definition at line 1846 of file ocipl.h.

Referenced by OCIPL::BindInput::BindInput().

{return &_val;}

Here is the caller graph for this function:

oraclenumber* OCIPL::SqlNumber::get_ref (  ) [inline]

Definition at line 1845 of file ocipl.h.

Referenced by OCIPL::BindOutput::BindOutput(), and OCIPL::DefinePar::DefinePar().

{return &_val;}

Here is the caller graph for this function:

const SqlInd& OCIPL::SqlValue::ind (  ) const [inline, inherited]
SqlInd& OCIPL::SqlValue::ind (  ) [inline, inherited]

Definition at line 1245 of file ocipl.h.

{return _ind;}
bool OCIPL::SqlValue::is_not_null (  ) const [inline, inherited]

Definition at line 1242 of file ocipl.h.

Referenced by OCIPL::SqlInt::operator int().

{return _ind.is_not_null();}

Here is the caller graph for this function:

bool OCIPL::SqlValue::is_null (  ) const [inline, inherited]

Definition at line 1241 of file ocipl.h.

{return _ind.is_null();}
OCIPL::SqlNumber::operator const OCINumber * (  ) const [inline]

Definition at line 1859 of file ocipl.h.

{return (OCINumber*)&_val;}
OCIPL::SqlNumber::operator OCINumber * (  ) [inline]

Definition at line 1858 of file ocipl.h.

{return (OCINumber*)&_val;}
tstring OCIPL::SqlNumber::str ( OCIError *  errh,
const TCHAR *  fmt = TEXT("TM9"),
const TCHAR *  nls_fmt = TEXT("NLS_NUMERIC_CHARACTERS='.,'") 
) const [inline]

Definition at line 1849 of file ocipl.h.

References OCIPL::number_to_str().

Referenced by OCIPL::SqlResult::get_string(), and SqlNumber().

    {
        if (_ind.is_not_null())
            return number_to_str(_val, errh, fmt, nls_fmt);
        else
            return tstring();
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

SqlInd OCIPL::SqlValue::_ind [protected, inherited]

Definition at line 1248 of file ocipl.h.

Referenced by OCIPL::OciDate::OciDate(), OCIPL::SqlString::operator=(), and SqlNumber().

Definition at line 1888 of file ocipl.h.

Referenced by SqlNumber().


The documentation for this struct was generated from the following files: