Public Member Functions | Protected Attributes

OCIPL::OciDate Struct Reference

wrapper for OCI DATE type More...

#include <ocipl.h>

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

List of all members.

Public Member Functions

 OciDate ()
 OciDate (const OCIDate &date, OCIInd ind=OCI_IND_NOTNULL)
 OciDate (const ocidatetime &date, OCIInd ind=OCI_IND_NOTNULL)
 OciDate (OCIError *errh, const TCHAR *str, const TCHAR *fmt=TEXT("dd.mm.yyyy"))
 OciDate (struct tm *t)
tstring str () const
tstring short_str () const
int get_int_date () const
struct tm * get_gmt () const
struct tm * get_lctime () const
time_t get_time_t () const
int compare (const OciDate &other) const
bool is_null () const
bool is_not_null () const
const SqlIndind () const
SqlIndind ()

Protected Attributes

SqlInd _ind

Detailed Description

wrapper for OCI DATE type

Definition at line 1558 of file ocipl.h.


Constructor & Destructor Documentation

OCIPL::OciDate::OciDate (  ) [inline]

Definition at line 1560 of file ocipl.h.

{}
OCIPL::OciDate::OciDate ( const OCIDate date,
OCIInd  ind = OCI_IND_NOTNULL 
)

Definition at line 779 of file ocipl.cpp.

 :  SqlValue(ind)
{
    OCIDate::operator=(date);
}
OCIPL::OciDate::OciDate ( const ocidatetime date,
OCIInd  ind = OCI_IND_NOTNULL 
)

Definition at line 785 of file ocipl.cpp.

References OCIPL::ocidatetime::century, OCIPL::ocidatetime::day, OCIPL::ocidatetime::hour, OCIPL::ocidatetime::minute, OCIPL::ocidatetime::month, OCIPL::ocidatetime::second, and OCIPL::ocidatetime::year.

 :  SqlValue(ind)
{
    OCIDateYYYY = 100*(date.century-100)+(date.year-100);
    OCIDateMM = date.month;
    OCIDateDD = date.day;
    OCIDateTime.OCITimeHH = date.hour-1;
    OCIDateTime.OCITimeMI = date.minute-1;
    OCIDateTime.OCITimeSS = date.second-1;
}
OCIPL::OciDate::OciDate ( OCIError *  errh,
const TCHAR *  str,
const TCHAR *  fmt = TEXT("dd.mm.yyyy") 
)

Definition at line 796 of file ocipl.cpp.

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

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

        if (*str) {
            sword res = OCIDateFromText(errh, (const OraText*)str, (ub4)_tcslen(str)*sizeof(TOraText),
                                              (const OraText*)fmt, (ub4)_tcslen(fmt)*sizeof(TOraText), NULL/*lang*/, 0, this);

            oci_check_error(errh, res);

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

Here is the call graph for this function:

OCIPL::OciDate::OciDate ( struct tm *  t )

Definition at line 815 of file ocipl.cpp.

References OCIPL::SqlValue::ind(), and OCIPL::SqlInd::set().

{
    OCIDateYYYY = t->tm_year + 1900;
    OCIDateMM = t->tm_mon + 1;
    OCIDateDD = t->tm_mday;
    OCIDateTime.OCITimeHH = t->tm_hour;
    OCIDateTime.OCITimeMI = t->tm_min;
    OCIDateTime.OCITimeSS = t->tm_sec;

    ind().set();
}

Here is the call graph for this function:


Member Function Documentation

int OCIPL::OciDate::compare ( const OciDate other ) const

Definition at line 827 of file ocipl.cpp.

{
    if (OCIDateYYYY < other.OCIDateYYYY)
        return -1;
    else if (OCIDateYYYY > other.OCIDateYYYY)
        return 1;

    if (OCIDateMM < other.OCIDateMM)
        return -1;
    else if (OCIDateMM > other.OCIDateMM)
        return 1;

    if (OCIDateDD < other.OCIDateDD)
        return -1;
    else if (OCIDateDD > other.OCIDateDD)
        return 1;

    if (OCIDateTime.OCITimeHH < other.OCIDateTime.OCITimeHH)
        return -1;
    else if (OCIDateTime.OCITimeHH > other.OCIDateTime.OCITimeHH)
        return 1;

    if (OCIDateTime.OCITimeMI < other.OCIDateTime.OCITimeMI)
        return -1;
    else if (OCIDateTime.OCITimeMI > other.OCIDateTime.OCITimeMI)
        return 1;

    if (OCIDateTime.OCITimeSS < other.OCIDateTime.OCITimeSS)
        return -1;
    else if (OCIDateTime.OCITimeSS > other.OCIDateTime.OCITimeSS)
        return 1;

    return 0;
}
struct tm* OCIPL::OciDate::get_gmt (  ) const [inline, read]

Definition at line 1590 of file ocipl.h.

References OCIPL::ocidate_to_gmt().

    {
        if (_ind.is_not_null())
            return ocidate_to_gmt(*this);
        else
            return 0;
    }

Here is the call graph for this function:

int OCIPL::OciDate::get_int_date (  ) const [inline]

Definition at line 1582 of file ocipl.h.

    {
        if (_ind.is_not_null())
            return ((OCIDateYYYY*100) + OCIDateMM)*100 + OCIDateDD;
        else
            return 0;
    }
struct tm* OCIPL::OciDate::get_lctime (  ) const [inline, read]

Definition at line 1598 of file ocipl.h.

References OCIPL::ocidate_to_lctime().

    {
        if (_ind.is_not_null())
            return ocidate_to_lctime(*this);
        else
            return 0;
    }

Here is the call graph for this function:

time_t OCIPL::OciDate::get_time_t (  ) const [inline]

Definition at line 1606 of file ocipl.h.

References OCIPL::ocidate_to_time_t().

    {
        if (_ind.is_not_null())
            return ocidate_to_time_t(*this);
        else
            return 0;
    }

Here is the call 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();}
tstring OCIPL::OciDate::short_str (  ) const [inline]

Definition at line 1574 of file ocipl.h.

References OCIPL::ocidate_to_short_string().

    {
        if (_ind.is_not_null())
            return ocidate_to_short_string(*this);
        else
            return tstring();
    }

Here is the call graph for this function:

tstring OCIPL::OciDate::str (  ) const [inline]

Definition at line 1566 of file ocipl.h.

References OCIPL::ocidate_to_string().

Referenced by OciDate().

    {
        if (_ind.is_not_null())
            return ocidate_to_string(*this);
        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 OciDate(), OCIPL::SqlString::operator=(), and OCIPL::SqlNumber::SqlNumber().


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