23 #include "ocilibcpp/types.hpp"
52 AcquireTransient(pDate, parent);
55 inline void Date::Allocate()
60 Environment::GetEnvironmentHandle()
86 inline int Date::Compare(
const Date& other)
const
98 int year = 0, month = 0, day = 0;
107 int year = 0, month = 0, day = 0;
115 int year = 0, month = 0, day = 0;
124 int year = 0, month = 0, day = 0;
132 int year = 0, month = 0, day = 0;
141 int year = 0, month = 0, day = 0;
149 int hour = 0, minutes = 0, seconds = 0;
151 GetTime(hour, minutes, seconds);
158 int hour = 0, minutes = 0, seconds = 0;
160 GetTime(hour, minutes, seconds);
161 SetTime(value, minutes, seconds);
166 int hour = 0, minutes = 0, seconds = 0;
168 GetTime(hour, minutes, seconds);
175 int hour = 0, minutes = 0, seconds = 0;
177 GetTime(hour, minutes, seconds);
183 int hour = 0, minutes = 0, seconds = 0;
185 GetTime(hour, minutes, seconds);
192 int hour = 0, minutes = 0, seconds = 0;
194 GetTime(hour, minutes, seconds);
228 inline void Date::GetDateTime(
int &year,
int &month,
int &day,
int &hour,
int &min,
int &sec)
const
275 const size_t size = OCI_SIZE_BUFFER;
284 return OCI_STRING_NULL;
323 return result += value;
329 return result -= value;
346 return Compare(other) == 0;
351 return !(*
this == other);
356 return Compare(other) > 0;
361 return Compare(other) < 0;
366 const int res = Compare(other);
368 return res == 0 || res > 0;
373 const int res = Compare(other);
375 return res == 0 || res < 0;
Object identifying the SQL data type DATE.
Date & operator-=(int value)
Decrement the date by the given number of days.
Date NextDay(const ostring &day) const
Return the date of next day of the week, after the current date object.
void FromString(const ostring &str, const ostring &format=OTEXT(""))
Assign to the date object the value provided by the input date time string.
bool operator>=(const Date &other) const
Indicates if the current date value is superior or equal to the given date value.
bool operator>(const Date &other) const
Indicates if the current date value is superior to the given date value.
void GetTime(int &hour, int &min, int &sec) const
Extract time parts.
int GetDay() const
Return the date day value.
void GetDateTime(int &year, int &month, int &day, int &hour, int &min, int &sec) const
Extract the date and time parts.
bool operator==(const Date &other) const
Indicates if the current date value is equal to the given date value.
void SetSeconds(int value)
Set the date seconds value.
void GetDate(int &year, int &month, int &day) const
Extract the date parts.
bool operator<(const Date &other) const
Indicates if the current date value is inferior to the given date value.
void SetDay(int value)
Set the date day value.
int GetHours() const
Return the date hours value.
void SetMinutes(int value)
Set the date minutes value.
static Date SysDate()
Return the current system date time.
void AddDays(int days)
Add or subtract days.
bool operator!=(const Date &other) const
Indicates if the current date value is not equal the given date value.
ostring ToString() const override
Convert the date value to a string using default format OCI_STRING_FORMAT_DATE.
void SetTime(int hour, int min, int sec)
Set the time part.
Date operator-(int value) const
Return a new date holding the current date value decremented by the given number of days.
int GetMinutes() const
Return the date minutes value.
Date & operator+=(int value)
Increment the date by the given number of days.
void SetHours(int value)
Set the date hours value.
bool operator<=(const Date &other) const
Indicates if the current date value is inferior or equal to the given date value.
int GetMonth() const
Return the date month value.
Date Clone() const
Clone the current instance to a new one performing deep copy.
void SetMonth(int value)
Set the date month value.
void AddMonths(int months)
Add or subtract months.
int GetSeconds() const
Return the date seconds value.
Date & operator--()
Decrement the date by 1 day.
Date LastDay() const
Return the last day of month from the current date object.
Date operator+(int value) const
Return a new date holding the current date value incremented by the given number of days.
void SetDate(int year, int month, int day)
Set the date part.
Date & operator++()
Increment the date by 1 day.
bool IsValid() const
Check if the given date is valid.
void SetDateTime(int year, int month, int day, int hour, int min, int sec)
Set the date and time part.
Date(bool create=false)
Create an empty null Date object.
int DaysBetween(const Date &other) const
Return the number of days with the given date.
void SetYear(int value)
Set the date year value.
int GetYear() const
Return the date year value.
void ChangeTimeZone(const ostring &tzSrc, const ostring &tzDst)
Convert the date from one zone to another zone.
static ostring GetFormat(FormatType formatType)
Return the format string for implicit string conversions of the given type.
Internal usage. Interface for handling ownership and relationship of a C API handle.
Internal usage. Provide a buffer class with RAII capabilities.
struct OCI_Date OCI_Date
Oracle internal date representation.
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_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_DateGetDate(OCI_Date *date, int *year, int *month, int *day)
Extract the date part from a date handle.
OCI_SYM_PUBLIC int OCI_API OCI_DateCompare(OCI_Date *date, OCI_Date *date2)
Compares two date handles.
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_DateCreate(OCI_Connection *con)
Create a local date object.
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.
OCI_SYM_PUBLIC int OCI_API OCI_DateDaysBetween(OCI_Date *date, OCI_Date *date2)
Return the number of days betWeen two dates.
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_DateSetTime(OCI_Date *date, int hour, int min, int sec)
Set the time portion if the given date handle.
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_DateAddMonths(OCI_Date *date, int nb)
Add or subtract months to a date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateAddDays(OCI_Date *date, int nb)
Add or subtract days to a date handle.
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.
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.
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 int OCI_API OCI_DateCheck(OCI_Date *date)
Check if the given date is valid.
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.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateSysDate(OCI_Date *date)
Return the current system date/time into the 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.
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so,...
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
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 )