23 #include "ocilibcpp/types.hpp" 48 Acquire(pTimestamp,
nullptr,
nullptr, parent);
60 inline int Timestamp::Compare(
const Timestamp& other)
const 104 int year, month, day;
113 int year, month, day;
121 int year, month, day;
130 int year, month, day;
138 int hour, minutes, seconds, milliseconds;
140 GetTime(hour, minutes, seconds, milliseconds);
147 int hour, minutes, seconds, milliseconds;
149 GetTime(hour, minutes, seconds, milliseconds);
150 SetTime(value, minutes, seconds, milliseconds);
155 int hour, minutes, seconds, milliseconds;
157 GetTime(hour, minutes, seconds, milliseconds);
164 int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
166 GetTime(hour, minutes, seconds, milliseconds);
167 SetTime(hour, value, seconds, milliseconds);
172 int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
174 GetTime(hour, minutes, seconds, milliseconds);
181 int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
183 GetTime(hour, minutes, seconds, milliseconds);
184 SetTime(hour, minutes, value, milliseconds);
189 int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
191 GetTime(hour, minutes, seconds, milliseconds);
198 int hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
200 GetTime(hour, minutes, seconds, milliseconds);
201 SetTime(hour, minutes, seconds, value);
221 int tmpYear = 0, tmpMonth = 0, tempDay = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
223 GetDateTime(tmpYear, tmpMonth, tempDay, hour, minutes, seconds, milliseconds);
224 SetDateTime(year, month, day, hour, minutes, seconds, milliseconds);
229 int year = 0, month = 0, day = 0, tmpHour = 0, tmpMinutes = 0, tmpSeconds = 0, tmpMilliseconds = 0;
231 GetDateTime(year, month, day, tmpHour, tmpMinutes, tmpSeconds, tmpMilliseconds);
232 SetDateTime(year, month, day, hour, min, sec, fsec);
239 int year = 0, month = 0, day = 0, hour = 0, minutes = 0, seconds = 0, milliseconds = 0;
241 GetDateTime(year, month, day, hour, minutes, seconds, milliseconds);
242 SetDateTime(year, month, day, hour, minutes, seconds, milliseconds, timeZone);
250 const size_t size = OCI_SIZE_BUFFER;
290 const size_t size = OCI_SIZE_BUFFER;
299 return OCI_STRING_NULL;
340 return result += value;
348 return result -= value;
361 return result += other;
367 return result -= other;
386 return *
this += interval;
393 return *
this -= interval;
398 return Compare(other) == 0;
403 return (!(*
this == other));
408 return (Compare(other) > 0);
413 return (Compare(other) < 0);
418 const int res = Compare(other);
420 return (res == 0 || res < 0);
425 const int res = Compare(other);
427 return (res == 0 || res > 0);
TimestampType GetType() const
Return the type of the given timestamp object.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetDateTime(OCI_Timestamp *tmsp, int *year, int *month, int *day, int *hour, int *min, int *sec, int *fsec)
Extract the date and time parts from a date handle.
bool operator>(const Timestamp &other) const
Indicates if the current Timestamp value is superior to the given Timestamp value.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFree(OCI_Timestamp *tmsp)
Free an OCI_Timestamp handle.
Timestamp & operator-=(int value)
Decrement the Timestamp by the given number of days.
Internal usage. Interface for handling ownership and relationship of a C API handle.
int GetYear() const
Return the timestamp year value.
void GetDateTime(int &year, int &month, int &day, int &hour, int &min, int &sec, int &fsec) const
Extract date and time parts.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampConvert(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp_src)
Convert one timestamp value from one type to another.
int GetSeconds() const
Return the timestamp seconds value.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampToText(OCI_Timestamp *tmsp, const otext *fmt, int size, otext *str, int precision)
Convert a timestamp value from the given timestamp handle to a string.
int GetMonth() const
Return the timestamp month value.
void SetHours(int value)
Set the timestamp hours value.
Timestamp Clone() const
Clone the current instance to a new one performing deep copy.
static ostring GetFormat(FormatType formatType)
Return the format string for implicit string conversions of the given type.
void Convert(const Timestamp &other)
Convert the current timestamp to the type of the given timestamp.
core::Enum< TimestampTypeValues > TimestampType
Type of timestamp.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TimestampGetType(OCI_Timestamp *tmsp)
Return the type of the given Timestamp object.
Timestamp & operator+=(int value)
Increment the Timestamp by the given number of days.
OCI_SYM_PUBLIC int OCI_API OCI_TimestampCheck(OCI_Timestamp *tmsp)
Check if the given timestamp is valid.
bool operator!=(const Timestamp &other) const
Indicates if the current Timestamp value is not equal the given Timestamp 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.
int GetMinutes() const
Return the timestamp minutes value.
bool operator<(const Timestamp &other) const
Indicates if the current Timestamp value is inferior to the given Timestamp value.
bool operator>=(const Timestamp &other) const
Indicates if the current Timestamp value is superior or equal to the given Timestamp value...
OCI_SYM_PUBLIC int OCI_API OCI_TimestampCompare(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp2)
Compares two timestamp handles.
struct OCI_Timestamp OCI_Timestamp
Oracle internal timestamp representation.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampIntervalAdd(OCI_Timestamp *tmsp, OCI_Interval *itv)
Add an interval value to a timestamp value of a timestamp handle.
Timestamp & operator++()
Increment the timestamp by 1 day.
Timestamp operator-(int value) const
Return a new Timestamp holding the current Timestamp value decremented by the given number of days...
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetDate(OCI_Timestamp *tmsp, int *year, int *month, int *day)
Extract the date part from a timestamp handle.
void FromString(const ostring &data, const ostring &format=OCI_STRING_FORMAT_DATE)
Assign to the timestamp object the value provided by the input date time string.
void SetDateTime(int year, int month, int day, int hour, int min, int sec, int fsec, const ostring &timeZone=OTEXT(""))
Set the timestamp value from given date time parts.
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_TimestampCreate(OCI_Connection *con, unsigned int type)
Create a local Timestamp instance.
void SetMinutes(int value)
Set the timestamp minutes value.
void GetDate(int &year, int &month, int &day) const
Extract the date parts.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetTime(OCI_Timestamp *tmsp, int *hour, int *min, int *sec, int *fsec)
Extract the time portion from a timestamp handle.
Template Enumeration template class providing some type safety to some extends for manipulating enume...
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampAssign(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp_src)
Assign the value of a timestamp handle to another one.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetTimeZoneName(OCI_Timestamp *tmsp, int size, otext *str)
Return the time zone name of a timestamp handle.
Timestamp & operator--()
Decrement the Timestamp by 1 day.
bool operator<=(const Timestamp &other) const
Indicates if the current Timestamp value is inferior or equal to the given Timestamp value...
void SetTimeZone(const ostring &timeZone)
Set the given time zone to the timestamp.
Object identifying the SQL data type INTERVAL.
ostring GetTimeZone() const
Return the name of the current time zone.
Internal usage. Provide a buffer class with RAII capabilities.
void SetSeconds(int value)
Set the timestamp seconds value.
void SetDay(int value)
Set the timestamp day value.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampSubtract(OCI_Timestamp *tmsp, OCI_Timestamp *tmsp2, OCI_Interval *itv)
Store the difference of two timestamp handles into an interval handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFromText(OCI_Timestamp *tmsp, const otext *str, const otext *fmt)
Convert a string to a timestamp and store it in the given timestamp handle.
void SetMilliSeconds(int value)
Set the timestamp milliseconds value.
bool operator==(const Timestamp &other) const
Indicates if the current Timestamp value is equal to the given Timestamp value.
static void Substract(const Timestamp &lsh, const Timestamp &rsh, Interval &result)
Subtract the given two timestamp and store the result into the given Interval.
ostring ToString() const override
Convert the timestamp value to a string using default date format and no precision.
void SetMonth(int value)
Set the timestamp month value.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampConstruct(OCI_Timestamp *tmsp, int year, int month, int day, int hour, int min, int sec, int fsec, const otext *time_zone)
Set a timestamp handle value.
void SetDate(int year, int month, int day)
Set the date part.
Timestamp()
Create an empty null timestamp instance.
void GetTime(int &hour, int &min, int &sec, int &fsec) const
Extract time parts.
void SetDay(int value)
Set the interval day value.
void SetYear(int value)
Set the timestamp year value.
int GetMilliSeconds() const
Return the timestamp seconds value.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampSysTimestamp(OCI_Timestamp *tmsp)
Stores the system current date and time as a timestamp value with time zone into the timestamp handle...
void SetTime(int hour, int min, int sec, int fsec)
Set the time part.
static Timestamp SysTimestamp(TimestampType type=NoTimeZone)
return the current system timestamp
bool IsValid() const
Check if the given timestamp is valid.
Timestamp operator+(int value) const
Return a new Timestamp holding the current Timestamp value incremented by the given number of days...
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampIntervalSub(OCI_Timestamp *tmsp, OCI_Interval *itv)
Subtract an interval value from a timestamp value of a timestamp handle.
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 ) ...
int GetDay() const
Return the timestamp day value.
Object identifying the SQL data type TIMESTAMP.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetTimeZoneOffset(OCI_Timestamp *tmsp, int *hour, int *min)
Return the time zone (hour, minute) portion of a timestamp handle.
void GetTimeZoneOffset(int &hour, int &min) const
Return the time zone (hour, minute) offsets.
int GetHours() const
Return the timestamp hours value.