23 #include "ocilibcpp/types.hpp" 52 Acquire(pDate,
nullptr,
nullptr, parent);
55 inline void Date::Allocate()
82 inline int Date::Compare(
const Date& other)
const 94 int year = 0, month = 0, day = 0;
103 int year = 0, month = 0, day = 0;
111 int year = 0, month = 0, day = 0;
120 int year = 0, month = 0, day = 0;
128 int year = 0, month = 0, day = 0;
137 int year = 0, month = 0, day = 0;
145 int hour = 0, minutes = 0, seconds = 0;
147 GetTime(hour, minutes, seconds);
154 int hour = 0, minutes = 0, seconds = 0;
156 GetTime(hour, minutes, seconds);
157 SetTime(value, minutes, seconds);
162 int hour = 0, minutes = 0, seconds = 0;
164 GetTime(hour, minutes, seconds);
171 int hour = 0, minutes = 0, seconds = 0;
173 GetTime(hour, minutes, seconds);
179 int hour = 0, minutes = 0, seconds = 0;
181 GetTime(hour, minutes, seconds);
188 int hour = 0, minutes = 0, seconds = 0;
190 GetTime(hour, minutes, seconds);
224 inline void Date::GetDateTime(
int &year,
int &month,
int &day,
int &hour,
int &min,
int &sec)
const 271 const size_t size = OCI_SIZE_BUFFER;
280 return OCI_STRING_NULL;
319 return result += value;
325 return result -= value;
342 return Compare(other) == 0;
347 return !(*
this == other);
352 return Compare(other) > 0;
357 return Compare(other) < 0;
362 const int res = Compare(other);
364 return res == 0 || res > 0;
369 const int res = Compare(other);
371 return res == 0 || res < 0;
bool operator<(const Date &other) const
Indicates if the current date value is inferior to the given date value.
bool IsValid() const
Check if the given date is valid.
Internal usage. Interface for handling ownership and relationship of a C API handle.
void SetMinutes(int value)
Set the date minutes value.
Date operator+(int value) const
Return a new date holding the current date value incremented by the given number of days...
void FromString(const ostring &str, const ostring &format=OTEXT(""))
Assign to the date object the value provided by the input date time string.
void ChangeTimeZone(const ostring &tzSrc, const ostring &tzDst)
Convert the date from one zone to another zone.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateGetDateTime(OCI_Date *date, int *year, int *month, int *day, int *hour, int *min, int *sec)
Extract the date and time parts from a date handle.
Date LastDay() const
Return the last day of month from the current date object.
Date NextDay(const ostring &day) const
Return the date of next day of the week, after the current date object.
Date(bool create=false)
Create an empty null Date object.
int GetMinutes() const
Return the date minutes value.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateZoneToZone(OCI_Date *date, const otext *zone1, const otext *zone2)
Convert a date from one zone to another zone.
static ostring GetFormat(FormatType formatType)
Return the format string for implicit string conversions of the given type.
bool operator<=(const Date &other) const
Indicates if the current date value is inferior or equal to the given date value. ...
int DaysBetween(const Date &other) const
Return the number of days with the given date.
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.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateSetTime(OCI_Date *date, int hour, int min, int sec)
Set the time portion if the given date handle.
int GetHours() const
Return the date hours value.
int GetDay() const
Return the date day value.
void SetSeconds(int value)
Set the date seconds value.
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_DateCreate(OCI_Connection *con)
Create a local date object.
int GetMonth() const
Return the date month value.
void SetDateTime(int year, int month, int day, int hour, int min, int sec)
Set the date and time part.
void SetHours(int value)
Set the date hours value.
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
void SetDay(int value)
Set the date day value.
static Date SysDate()
Return the current system date time.
void SetDate(int year, int month, int day)
Set the date part.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateGetDate(OCI_Date *date, int *year, int *month, int *day)
Extract the date part from a date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateGetTime(OCI_Date *date, int *hour, int *min, int *sec)
Extract the time part from a date handle.
OCI_SYM_PUBLIC int OCI_API OCI_DateCheck(OCI_Date *date)
Check if the given date is valid.
ostring ToString() const override
Convert the date value to a string using default format OCI_STRING_FORMAT_DATE.
void SetMonth(int value)
Set the date month value.
struct OCI_Date OCI_Date
Oracle internal date representation.
OCI_SYM_PUBLIC int OCI_API OCI_DateAssign(OCI_Date *date, OCI_Date *date_src)
Assign the value of a date handle to another one.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateAddDays(OCI_Date *date, int nb)
Add or subtract days to a date handle.
OCI_SYM_PUBLIC int OCI_API OCI_DateCompare(OCI_Date *date, OCI_Date *date2)
Compares two date handles.
Internal usage. Provide a buffer class with RAII capabilities.
int GetSeconds() const
Return the date seconds value.
bool operator!=(const Date &other) const
Indicates if the current date value is not equal the given date value.
void AddDays(int days)
Add or subtract days.
void GetDate(int &year, int &month, int &day) const
Extract the date parts.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateNextDay(OCI_Date *date, const otext *day)
Gets the date of next day of the week, after a given date.
bool operator>=(const Date &other) const
Indicates if the current date value is superior or equal to the given date value. ...
void SetTime(int hour, int min, int sec)
Set the time part.
bool operator==(const Date &other) const
Indicates if the current date value is equal to the given date value.
void GetTime(int &hour, int &min, int &sec) const
Extract time parts.
void GetDateTime(int &year, int &month, int &day, int &hour, int &min, int &sec) const
Extract the date and time parts.
Date & operator--()
Decrement the date by 1 day.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateToText(OCI_Date *date, const otext *fmt, int size, otext *str)
Convert a Date value from the given date handle to a string.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateFree(OCI_Date *date)
Free a date object.
Date Clone() const
Clone the current instance to a new one performing deep copy.
Date operator-(int value) const
Return a new date holding the current date value decremented by the given number of days...
Date & operator-=(int value)
Decrement the date by the given number of days.
Date & operator+=(int value)
Increment the date by the given number of days.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateSetDate(OCI_Date *date, int year, int month, int day)
Set the date portion if the given date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateLastDay(OCI_Date *date)
Place the last day of month (from the given date) into the given date.
int GetYear() const
Return the date year value.
bool operator>(const Date &other) const
Indicates if the current date value is superior to the given date value.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateAddMonths(OCI_Date *date, int nb)
Add or subtract months to a date handle.
void SetYear(int value)
Set the date year value.
Date & operator++()
Increment the date by 1 day.
OCI_SYM_PUBLIC int OCI_API OCI_DateDaysBetween(OCI_Date *date, OCI_Date *date2)
Return the number of days betWeen two dates.
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 ) ...
void AddMonths(int months)
Add or subtract months.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateSetDateTime(OCI_Date *date, int year, int month, int day, int hour, int min, int sec)
Set the date and time portions if the given date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateFromText(OCI_Date *date, const otext *str, const otext *fmt)
Convert a string to a date and store it in the given date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateSysDate(OCI_Date *date)
Return the current system date/time into the date handle.
Object identifying the SQL data type DATE.