23 #include "ocilibcpp/types.hpp" 49 Acquire(pInterval,
nullptr,
nullptr, parent);
61 inline int Interval::Compare(
const Interval& other)
const 78 int year = 0, month = 0;
87 int year = 0, month = 0;
95 int year = 0, month = 0;
104 int year = 0, month = 0;
112 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
114 GetDaySecond(day, hour, minutes, seconds, milliseconds);
121 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
123 GetDaySecond(day, hour, minutes, seconds, milliseconds);
124 SetDaySecond(value, hour, minutes, seconds, milliseconds);
129 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
131 GetDaySecond(day, hour, minutes, seconds, milliseconds);
138 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
140 GetDaySecond(day, hour, minutes, seconds, milliseconds);
141 SetDaySecond(day, value, minutes, seconds, milliseconds);
146 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
148 GetDaySecond(day, hour, minutes, seconds, milliseconds);
155 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
157 GetDaySecond(day, hour, minutes, seconds, milliseconds);
163 int day, hour, minutes, seconds, milliseconds;
165 GetDaySecond(day, hour, minutes, seconds, milliseconds);
172 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
174 GetDaySecond(day, hour, minutes, seconds, milliseconds);
180 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
182 GetDaySecond(day, hour, minutes, seconds, milliseconds);
189 int day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
191 GetDaySecond(day, hour, minutes, seconds, milliseconds);
228 const size_t size = OCI_SIZE_BUFFER;
237 return OCI_STRING_NULL;
242 return ToString(OCI_STRING_DEFAULT_PREC, OCI_STRING_DEFAULT_PREC);
248 return result += other;
254 return result -= other;
271 return Compare(other) == 0;
276 return (!(*
this == other));
281 return (Compare(other) > 0);
286 return (Compare(other) < 0);
291 const int res = Compare(other);
293 return (res == 0 || res < 0);
298 const int res = Compare(other);
300 return (res == 0 || res > 0);
Interval operator-(const Interval &other) const
Return a new Interval holding the difference of the current Interval value and the given Interval val...
void SetHours(int value)
Set the interval hours value.
Internal usage. Interface for handling ownership and relationship of a C API handle.
bool operator!=(const Interval &other) const
Indicates if the current Interval value is not equal the given Interval value.
Interval()
Create an empty null Interval instance.
int GetSeconds() const
Return the interval seconds value.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalGetYearMonth(OCI_Interval *itv, int *year, int *month)
Return the year / month portion of an interval handle.
ostring ToString() const override
Convert the interval value to a string using the default precisions of 10.
int GetMonth() const
Return the interval month value.
void SetDaySecond(int day, int hour, int min, int sec, int fsec)
Set the Day / Second parts.
int GetDay() const
Return the interval day value.
int GetHours() const
Return the interval hours value.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_IntervalGetType(OCI_Interval *itv)
Return the type of the given Interval object.
core::Enum< IntervalTypeValues > IntervalType
Interval types.
void SetYear(int value)
Set the interval year value.
struct OCI_Interval OCI_Interval
Oracle internal interval representation.
bool operator>(const Interval &other) const
Indicates if the current Interval value is superior to the given Interval value.
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so, it raises a C++ exception using the retrieved error handle.
void SetMinutes(int value)
Set the interval minutes value.
int GetYear() const
Return the interval year value.
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_IntervalCreate(OCI_Connection *con, unsigned int type)
Create a local interval object.
OCI_SYM_PUBLIC int OCI_API OCI_IntervalCheck(OCI_Interval *itv)
Check if the given interval is valid.
void FromString(const ostring &data)
Assign to the interval object the value provided by the input interval string.
bool operator<=(const Interval &other) const
Indicates if the current Interval value is inferior or equal to the given Interval value...
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalGetDaySecond(OCI_Interval *itv, int *day, int *hour, int *min, int *sec, int *fsec)
Return the day / time portion of an interval handle.
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
bool operator>=(const Interval &other) const
Indicates if the current Interval value is superior or equal to the given Interval value...
void SetMilliSeconds(int value)
Set the interval milliseconds value.
Interval operator+(const Interval &other) const
Return a new Interval holding the sum of the current Interval value and the given Interval value...
Interval & operator+=(const Interval &other)
Increment the current Value with the given Interval value.
Template Enumeration template class providing some type safety to some extends for manipulating enume...
Object identifying the SQL data type INTERVAL.
int GetMilliSeconds() const
Return the interval seconds value.
Internal usage. Provide a buffer class with RAII capabilities.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalAdd(OCI_Interval *itv, OCI_Interval *itv2)
Adds an interval handle value to another.
void UpdateTimeZone(const ostring &timeZone)
Update the interval value with the given time zone.
int GetMinutes() const
Return the interval minutes value.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFromText(OCI_Interval *itv, const otext *str)
Convert a string to an interval and store it in the given interval handle.
OCI_SYM_PUBLIC int OCI_API OCI_IntervalCompare(OCI_Interval *itv, OCI_Interval *itv2)
Compares two interval handles.
void GetYearMonth(int &year, int &month) const
Extract the year / month parts from the interval value.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFree(OCI_Interval *itv)
Free an OCI_Interval handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSubtract(OCI_Interval *itv, OCI_Interval *itv2)
Subtract an interval handle value from another.
void GetDaySecond(int &day, int &hour, int &min, int &sec, int &fsec) const
Extract the date / second parts from the interval value.
IntervalType GetType() const
Return the type of the given interval object.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFromTimeZone(OCI_Interval *itv, const otext *str)
Correct an interval handle value with the given time zone.
Interval & operator-=(const Interval &other)
Decrement the current Value with the given Interval value.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalToText(OCI_Interval *itv, int leading_prec, int fraction_prec, int size, otext *str)
Convert an interval value from the given interval handle to a string.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalAssign(OCI_Interval *itv, OCI_Interval *itv_src)
Assign the value of a interval handle to another one.
bool operator<(const Interval &other) const
Indicates if the current Interval value is inferior to the given Interval value.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSetYearMonth(OCI_Interval *itv, int year, int month)
Set the year / month portion if the given Interval handle.
void SetDay(int value)
Set the interval day value.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSetDaySecond(OCI_Interval *itv, int day, int hour, int min, int sec, int fsec)
Set the day / time portion if the given interval handle.
Interval Clone() const
Clone the current instance to a new one performing deep copy.
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 ) ...
bool IsValid() const
Check if the given interval is valid.
void SetSeconds(int value)
Set the interval seconds value.
void SetMonth(int value)
Set the interval month value.
void SetYearMonth(int year, int month)
Set the Year / Month parts.
bool operator==(const Interval &other) const
Indicates if the current Interval value is equal to the given Interval value.