OCILIB (C and C++ Driver for Oracle)  4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
Timestamps and intervals manipulation

Detailed Description

OcilibCApiDatetimes

OCILIB encapsulates Oracle :

Basically, the OCI_Timestamp and OCI_Interval routines are wrappers around the Oracle OCIDatetime and OCIInterval APIs

Examples
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
#define SIZE_STR 260
int main(void)
{
char str[SIZE_STR + 1];
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
tm = OCI_TimestampCreate(NULL, OCI_TIMESTAMP);
itv = OCI_IntervalCreate(NULL, OCI_INTERVAL_DS);
OCI_TimestampSysTimeStamp(tm);
OCI_TimestampToText(tm, "DD/MM/YYYY HH24:MI:SS:FF3", SIZE_STR, str, 3);
printf("%s\n", str);
OCI_IntervalSetDaySecond(itv, 1, 1, 1, 1, 0);
OCI_IntervalToText(itv, 10, 10, SIZE_STR, str);
printf("%s\n", str);
OCI_TimestampToText(tm, "DD/MM/YYYY HH24:MI:SS:FF3", SIZE_STR, str, 3);
printf("%s\n", str);
return EXIT_SUCCESS;
}
struct OCI_Timestamp OCI_Timestamp
Oracle internal timestamp representation.
Definition: types.h:289
struct OCI_Error OCI_Error
Encapsulates an Oracle or OCILIB exception.
Definition: types.h:390
struct OCI_Interval OCI_Interval
Oracle internal interval representation.
Definition: types.h:299
OCI_SYM_PUBLIC const otext *OCI_API OCI_ErrorGetString(OCI_Error *err)
Retrieve error message from error handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_Cleanup(void)
Clean up all resources allocated by the library.
OCI_SYM_PUBLIC boolean OCI_API OCI_Initialize(POCI_ERROR err_handler, const otext *lib_path, unsigned int mode)
Initialize the library.
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_IntervalCreate(OCI_Connection *con, unsigned int type)
Create a local interval object.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFree(OCI_Interval *itv)
Free an OCI_Interval handle.
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.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFree(OCI_Timestamp *tmsp)
Free an OCI_Timestamp handle.
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_TimestampCreate(OCI_Connection *con, unsigned int type)
Create a local Timestamp instance.
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.
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_IntervalSetDaySecond(OCI_Interval *itv, int day, int hour, int min, int sec, int fsec)
Set the day / time portion if the given interval handle.

Functions

OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_TimestampCreate (OCI_Connection *con, unsigned int type)
 Create a local Timestamp instance.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFree (OCI_Timestamp *tmsp)
 Free an OCI_Timestamp handle.
 
OCI_SYM_PUBLIC OCI_Timestamp **OCI_API OCI_TimestampArrayCreate (OCI_Connection *con, unsigned int type, unsigned int nbelem)
 Create an array of timestamp object.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampArrayFree (OCI_Timestamp **tmsps)
 Free an array of timestamp objects.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TimestampGetType (OCI_Timestamp *tmsp)
 Return the type of the given Timestamp object.
 
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 int OCI_API OCI_TimestampCheck (OCI_Timestamp *tmsp)
 Check if the given timestamp is valid.
 
OCI_SYM_PUBLIC int OCI_API OCI_TimestampCompare (OCI_Timestamp *tmsp, OCI_Timestamp *tmsp2)
 Compares two timestamp handles.
 
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.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampConvert (OCI_Timestamp *tmsp, OCI_Timestamp *tmsp_src)
 Convert one timestamp value from one type to another.
 
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.
 
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.
 
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.
 
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.
 
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.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetTimeZoneName (OCI_Timestamp *tmsp, int size, otext *str)
 Return the time zone name of a timestamp handle.
 
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.
 
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.
 
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.
 
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_TimestampSysTimestamp (OCI_Timestamp *tmsp)
 Stores the system current date and time as a timestamp value with time zone into the timestamp handle.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampToCTime (OCI_Timestamp *tmsp, struct tm *ptm, time_t *pt)
 Affect an OCI_Timestamp handle value to ISO C time data types.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFromCTime (OCI_Timestamp *tmsp, struct tm *ptm, time_t t)
 Affect ISO C time data types values to an OCI_Timestamp handle.
 
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_IntervalCreate (OCI_Connection *con, unsigned int type)
 Create a local interval object.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFree (OCI_Interval *itv)
 Free an OCI_Interval handle.
 
OCI_SYM_PUBLIC OCI_Interval **OCI_API OCI_IntervalArrayCreate (OCI_Connection *con, unsigned int type, unsigned int nbelem)
 Create an array of Interval object.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalArrayFree (OCI_Interval **itvs)
 Free an array of Interval objects.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_IntervalGetType (OCI_Interval *itv)
 Return the type of the given Interval object.
 
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.
 
OCI_SYM_PUBLIC int OCI_API OCI_IntervalCheck (OCI_Interval *itv)
 Check if the given interval is valid.
 
OCI_SYM_PUBLIC int OCI_API OCI_IntervalCompare (OCI_Interval *itv, OCI_Interval *itv2)
 Compares two interval handles.
 
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 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_IntervalFromTimeZone (OCI_Interval *itv, const otext *str)
 Correct an interval handle value with the given time zone.
 
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.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalGetYearMonth (OCI_Interval *itv, int *year, int *month)
 Return the year / month portion of an interval handle.
 
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.
 
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.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalAdd (OCI_Interval *itv, OCI_Interval *itv2)
 Adds an interval handle value to another.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSubtract (OCI_Interval *itv, OCI_Interval *itv2)
 Subtract an interval handle value from another.
 

Function Documentation

◆ OCI_TimestampCreate()

OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_TimestampCreate ( OCI_Connection con,
unsigned int  type 
)

#include <api.h>

Create a local Timestamp instance.

Parameters
con- Connection handle
type- Timestamp type
Note
From version 2.5.0, parameter 'con' can be NULL in order to manipulate timestamps independently from database connections
Timestamp type can be :
  • OCI_TIMESTAMP : timestamp
  • OCI_TIMESTAMP_TZ : timestamp with time zone
  • OCI_TIMESTAMP_LTZ : timestamp with local time zone
Returns
Return the Timestamp handle on success otherwise NULL on failure

Referenced by ocilib::Timestamp::Timestamp().

◆ OCI_TimestampFree()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFree ( OCI_Timestamp tmsp)

#include <api.h>

Free an OCI_Timestamp handle.

Parameters
tmsp- Timestamp handle
Warning
Only Timestamp created with OCI_TimestampCreate() should be freed by OCI_IntervalFree()
Returns
TRUE on success otherwise FALSE

◆ OCI_TimestampArrayCreate()

OCI_SYM_PUBLIC OCI_Timestamp **OCI_API OCI_TimestampArrayCreate ( OCI_Connection con,
unsigned int  type,
unsigned int  nbelem 
)

#include <api.h>

Create an array of timestamp object.

Parameters
con- Connection handle
type- Timestamp type
nbelem- number of elements in the array
Note
see OCI_TimestampCreate() for more details
Returns
Return the timestamp handle array on success otherwise NULL on failure

◆ OCI_TimestampArrayFree()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampArrayFree ( OCI_Timestamp **  tmsps)

#include <api.h>

Free an array of timestamp objects.

Parameters
tmsps- Array of timestamp objects
Warning
Only arrays of timestamp created with OCI_TimestampArrayCreate() should be freed by OCI_TimestampArrayFree()
Returns
TRUE on success otherwise FALSE

◆ OCI_TimestampGetType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_TimestampGetType ( OCI_Timestamp tmsp)

#include <api.h>

Return the type of the given Timestamp object.

Parameters
tmsp- Timestamp handle
Note
For possible values, see OCI_TimestampCreate()
Returns
Object type or OCI_UNKNOWN the input handle is NULL

Referenced by ocilib::Timestamp::GetType().

◆ OCI_TimestampAssign()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampAssign ( OCI_Timestamp tmsp,
OCI_Timestamp tmsp_src 
)

#include <api.h>

Assign the value of a timestamp handle to another one.

Parameters
tmsp- Destination Timestamp handle
tmsp_src- Source Timestamp handle
Note
Both timestamp handles must be of the same type
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::Clone().

◆ OCI_TimestampCheck()

OCI_SYM_PUBLIC int OCI_API OCI_TimestampCheck ( OCI_Timestamp tmsp)

#include <api.h>

Check if the given timestamp is valid.

Parameters
tmsp- Timestamp handle
Returns
  • Zero if the timestamp value is valid
  • Any other value means the timestamp value is invalid

Referenced by ocilib::Timestamp::IsValid().

◆ OCI_TimestampCompare()

OCI_SYM_PUBLIC int OCI_API OCI_TimestampCompare ( OCI_Timestamp tmsp,
OCI_Timestamp tmsp2 
)

#include <api.h>

Compares two timestamp handles.

Parameters
tmsp- Timestamp1 handle
tmsp2- Timestamp2 handle
Returns
  • -1 if Timestamp1 is smaller than Timestamp2,
  • 0 if they are equal
  • 1 if Timestamp1 is greater than Timestamp2.

◆ OCI_TimestampConstruct()

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 
)

#include <api.h>

Set a timestamp handle value.

Parameters
tmsp- Timestamp handle
year- Year value
month- Month value
day- Day value
hour- hour value
min- minutes value
sec- seconds value
fsec- fractional part of seconds value
time_zone- name of a time zone to use [optional]
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::SetDateTime().

◆ OCI_TimestampConvert()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampConvert ( OCI_Timestamp tmsp,
OCI_Timestamp tmsp_src 
)

#include <api.h>

Convert one timestamp value from one type to another.

Parameters
tmsp- Timestamp handle to convert
tmsp_src- Timestamp handle to use for the type conversion
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::Convert().

◆ OCI_TimestampFromText()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFromText ( OCI_Timestamp tmsp,
const otext *  str,
const otext *  fmt 
)

#include <api.h>

Convert a string to a timestamp and store it in the given timestamp handle.

Parameters
tmsp- Destination Timestamp handle
str- Source date string
fmt- Date format
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::FromString().

◆ OCI_TimestampToText()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampToText ( OCI_Timestamp tmsp,
const otext *  fmt,
int  size,
otext *  str,
int  precision 
)

#include <api.h>

Convert a timestamp value from the given timestamp handle to a string.

Parameters
tmsp- source Timestamp handle
fmt- Timestamp format
size- Destination string size in characters
str- Destination date string
precision- Precision for fractional part of the seconds
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::ToString().

◆ OCI_TimestampGetDate()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetDate ( OCI_Timestamp tmsp,
int *  year,
int *  month,
int *  day 
)

#include <api.h>

Extract the date part from a timestamp handle.

Parameters
tmsp- Timestamp handle
year- Place holder for year value
month- Place holder for month value
day- Place holder for day value
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::GetDate().

◆ OCI_TimestampGetTime()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetTime ( OCI_Timestamp tmsp,
int *  hour,
int *  min,
int *  sec,
int *  fsec 
)

#include <api.h>

Extract the time portion from a timestamp handle.

Parameters
tmsp- Timestamp handle
hour- Place holder for hour value
min- Place holder for minute value
sec- Place holder for second value
fsec- Place holder for fractional part of second value
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::GetTime().

◆ OCI_TimestampGetDateTime()

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 
)

#include <api.h>

Extract the date and time parts from a date handle.

Parameters
tmsp- Date handle
year- Place holder for year value
month- Place holder for month value
day- Place holder for day value
hour- Place holder for hour value
min- Place holder for minute value
sec- Place holder for second value
fsec- Place holder for fractional part of seconds value
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::GetDateTime().

◆ OCI_TimestampGetTimeZoneName()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetTimeZoneName ( OCI_Timestamp tmsp,
int  size,
otext *  str 
)

#include <api.h>

Return the time zone name of a timestamp handle.

Parameters
tmsp- Timestamp handle
size- Destination string size in characters
str- Destination zone name string
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::GetTimeZone().

◆ OCI_TimestampGetTimeZoneOffset()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampGetTimeZoneOffset ( OCI_Timestamp tmsp,
int *  hour,
int *  min 
)

#include <api.h>

Return the time zone (hour, minute) portion of a timestamp handle.

Parameters
tmsp- Timestamp handle
hour- Place holder for hour value
min- Place holder for min value
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::GetTimeZoneOffset().

◆ OCI_TimestampIntervalAdd()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampIntervalAdd ( OCI_Timestamp tmsp,
OCI_Interval itv 
)

#include <api.h>

Add an interval value to a timestamp value of a timestamp handle.

Parameters
tmsp- Timestamp handle
itv- Interval handle
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::operator+=().

◆ OCI_TimestampIntervalSub()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampIntervalSub ( OCI_Timestamp tmsp,
OCI_Interval itv 
)

#include <api.h>

Subtract an interval value from a timestamp value of a timestamp handle.

Parameters
tmsp- Timestamp handle
itv- Interval handle
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::operator-=().

◆ OCI_TimestampSubtract()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampSubtract ( OCI_Timestamp tmsp,
OCI_Timestamp tmsp2,
OCI_Interval itv 
)

#include <api.h>

Store the difference of two timestamp handles into an interval handle.

Parameters
tmsp- Timestamp handle (subtrahend)
tmsp2- Timestamp2 handle (minuend)
itv- Interval handle
Note
The function acts like tmsp - tmsp2 = itv
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::operator-(), and ocilib::Timestamp::Substract().

◆ OCI_TimestampSysTimestamp()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampSysTimestamp ( OCI_Timestamp tmsp)

#include <api.h>

Stores the system current date and time as a timestamp value with time zone into the timestamp handle.

Parameters
tmsp- Timestamp handle
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Timestamp::SysTimestamp().

◆ OCI_TimestampToCTime()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampToCTime ( OCI_Timestamp tmsp,
struct tm *  ptm,
time_t *  pt 
)

#include <api.h>

Affect an OCI_Timestamp handle value to ISO C time data types.

Parameters
tmsp- Timestamp handle
ptm- Pointer to a structure tm to receive date/time values
pt- Pointer to a time_t to hold the date/time in the time_t format
Note
Both parameters 'ptm' and 'p' are optional but one of them has to be provided.
Returns
TRUE on success otherwise FALSE

◆ OCI_TimestampFromCTime()

OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFromCTime ( OCI_Timestamp tmsp,
struct tm *  ptm,
time_t  t 
)

#include <api.h>

Affect ISO C time data types values to an OCI_Timestamp handle.

Parameters
tmsp- Timestamp handle
ptm- Pointer to a structure tm that hold the date/time value
t- Value (time_t) that hold the date/time in the time_t format
Note
Both parameters 'ptm' and 'p' are optional but one of them has to be provided. If 'ptm' is not null, its value is affected to the OCI_Timestamp handle, otherwise the value of 't' is used.
Returns
TRUE on success otherwise FALSE

◆ OCI_IntervalCreate()

OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_IntervalCreate ( OCI_Connection con,
unsigned int  type 
)

#include <api.h>

Create a local interval object.

Parameters
con- Connection handle
type- Type of Interval
Note
From version 2.5.0, parameter 'con' can be NULL in order to manipulate intervals independently from database connections
Interval type can be :
  • OCI_INTERVAL_YM : year / month interval
  • OCI_INTERVAL_DS : date/ time interval
Returns
Return the Interval handle on success otherwise NULL on failure

Referenced by ocilib::Interval::Interval().

◆ OCI_IntervalFree()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFree ( OCI_Interval itv)

#include <api.h>

Free an OCI_Interval handle.

Parameters
itv- Interval handle
Warning
Only Intervals created with OCI_IntervalCreate() should be freed by OCI_IntervalFree()
Returns
TRUE on success otherwise FALSE

◆ OCI_IntervalArrayCreate()

OCI_SYM_PUBLIC OCI_Interval **OCI_API OCI_IntervalArrayCreate ( OCI_Connection con,
unsigned int  type,
unsigned int  nbelem 
)

#include <api.h>

Create an array of Interval object.

Parameters
con- Connection handle
type- Type of Interval
nbelem- number of elements in the array
Note
see OCI_IntervalCreate() for more details
Returns
Return the Interval handle array on success otherwise NULL on failure

◆ OCI_IntervalArrayFree()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalArrayFree ( OCI_Interval **  itvs)

#include <api.h>

Free an array of Interval objects.

Parameters
itvs- Array of Interval objects
Warning
Only arrays of Interval created with OCI_IntervalArrayCreate() should be freed by OCI_IntervalArrayFree()
Returns
TRUE on success otherwise FALSE

◆ OCI_IntervalGetType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_IntervalGetType ( OCI_Interval itv)

#include <api.h>

Return the type of the given Interval object.

Parameters
itv- Interval handle
Note
For possible values, see OCI_IntervalCreate()
Returns
Object type or OCI_UNKNOWN the input handle is NULL

Referenced by ocilib::Interval::GetType().

◆ OCI_IntervalAssign()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalAssign ( OCI_Interval itv,
OCI_Interval itv_src 
)

#include <api.h>

Assign the value of a interval handle to another one.

Parameters
itv- Destination interval handle
itv_src- Source interval handle
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::Clone().

◆ OCI_IntervalCheck()

OCI_SYM_PUBLIC int OCI_API OCI_IntervalCheck ( OCI_Interval itv)

#include <api.h>

Check if the given interval is valid.

Parameters
itv- Interval handle
Returns
  • Zero if the interval value is valid
  • Any other value means the interval value is invalid

Referenced by ocilib::Interval::IsValid().

◆ OCI_IntervalCompare()

OCI_SYM_PUBLIC int OCI_API OCI_IntervalCompare ( OCI_Interval itv,
OCI_Interval itv2 
)

#include <api.h>

Compares two interval handles.

Parameters
itv- Interval1 handle
itv2- Interval2 handle
Returns
  • -1 if interval1 is smaller than interval2,
  • 0 if they are equal
  • 1 if interval1 is greater than interval2.

◆ OCI_IntervalFromText()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFromText ( OCI_Interval itv,
const otext *  str 
)

#include <api.h>

Convert a string to an interval and store it in the given interval handle.

Parameters
itv- Destination interval handle
str- Source date string
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::FromString().

◆ OCI_IntervalToText()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalToText ( OCI_Interval itv,
int  leading_prec,
int  fraction_prec,
int  size,
otext *  str 
)

#include <api.h>

Convert an interval value from the given interval handle to a string.

Parameters
itv- source Interval handle
leading_prec- Precision of the leading part
fraction_prec- Precision of the fractional part
size- Destination string size in characters
str- Destination date string
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::ToString().

◆ OCI_IntervalFromTimeZone()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFromTimeZone ( OCI_Interval itv,
const otext *  str 
)

#include <api.h>

Correct an interval handle value with the given time zone.

Parameters
itv- Interval handle
str- Time zone name
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::UpdateTimeZone().

◆ OCI_IntervalGetDaySecond()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalGetDaySecond ( OCI_Interval itv,
int *  day,
int *  hour,
int *  min,
int *  sec,
int *  fsec 
)

#include <api.h>

Return the day / time portion of an interval handle.

Parameters
itv- Interval handle
day- Place holder for day value
hour- Place holder for hours value
min- Place holder for minutes value
sec- Place holder for seconds value
fsec- Place holder for fractional part of seconds value
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::GetDaySecond().

◆ OCI_IntervalGetYearMonth()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalGetYearMonth ( OCI_Interval itv,
int *  year,
int *  month 
)

#include <api.h>

Return the year / month portion of an interval handle.

Parameters
itv- Interval handle
year- Place holder for year value
month- Place holder for month value
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::GetYearMonth().

◆ OCI_IntervalSetDaySecond()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSetDaySecond ( OCI_Interval itv,
int  day,
int  hour,
int  min,
int  sec,
int  fsec 
)

#include <api.h>

Set the day / time portion if the given interval handle.

Parameters
itv- Interval handle
day- day value
hour- Hour value
min- Minute value
sec- Second value
fsec- Fractional part of the seconds
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::SetDaySecond().

◆ OCI_IntervalSetYearMonth()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSetYearMonth ( OCI_Interval itv,
int  year,
int  month 
)

#include <api.h>

Set the year / month portion if the given Interval handle.

Parameters
itv- Interval handle
year- Year value
month- Month value
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::SetYearMonth().

◆ OCI_IntervalAdd()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalAdd ( OCI_Interval itv,
OCI_Interval itv2 
)

#include <api.h>

Adds an interval handle value to another.

Parameters
itv- Interval handle from witch to add
itv2- Interval handle to add
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::operator+=().

◆ OCI_IntervalSubtract()

OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSubtract ( OCI_Interval itv,
OCI_Interval itv2 
)

#include <api.h>

Subtract an interval handle value from another.

Parameters
itv- Interval handle from witch to remove
itv2- Interval handle to remove
Returns
TRUE on success otherwise FALSE

Referenced by ocilib::Interval::operator-=().