📄 ocikp.h
字号:
sword OCIDateTimeCheck(dvoid *hndl, OCIError *err, CONST OCIDateTime *date,
ub4 *valid );
NAME: OCIDateTimeCheck - OCIDateTime CHecK if the given date is valid
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
date (IN) - date to be checked
type (IN) - type of the input datetime(OCI_DATE, OCI_TIME,
OCI_TIMESTAMP, OCI_TZTIMESTAMP, OCI_TZTIME)
valid (OUT) - returns zero for a valid date, otherwise
the ORed combination of all error bits specified below:
Macro name Bit number Error
---------- ---------- -----
OCI_DATE_INVALID_DAY 0x1 Bad day
OCI_DATE_DAY_BELOW_VALID 0x2 Bad DAy Low/high bit (1=low)
OCI_DATE_INVALID_MONTH 0x4 Bad MOnth
OCI_DATE_MONTH_BELOW_VALID 0x8 Bad MOnth Low/high bit (1=low)
OCI_DATE_INVALID_YEAR 0x10 Bad YeaR
OCI_DATE_YEAR_BELOW_VALID 0x20 Bad YeaR Low/high bit (1=low)
OCI_DATE_INVALID_HOUR 0x40 Bad HouR
OCI_DATE_HOUR_BELOW_VALID 0x80 Bad HouR Low/high bit (1=low)
OCI_DATE_INVALID_MINUTE 0x100 Bad MiNute
OCI_DATE_MINUTE_BELOW_VALID 0x200 Bad MiNute Low/high bit (1=low)
OCI_DATE_INVALID_SECOND 0x400 Bad SeCond
OCI_DATE_SECOND_BELOW_VALID 0x800 bad second Low/high bit (1=low)
OCI_DATE_DAY_MISSING_FROM_1582 0x1000 Day is one of those "missing"
from 1582
OCI_DATE_YEAR_ZERO 0x2000 Year may not equal zero
OCI_DATE_INVALID_TIMEZONE 0x4000 Bad Timezone
OCI_DATE_INVALID_FORMAT 0x8000 Bad date format input
So, for example, if the date passed in was 2/0/1990 25:61:10 in
(month/day/year hours:minutes:seconds format), the error returned
would be OCI_DATE_INVALID_DAY | OCI_DATE_DAY_BELOW_VALID |
OCI_DATE_INVALID_HOUR | OCI_DATE_INVALID_MINUTE
DESCRIPTION:
Check if the given date is valid.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
'date' and 'valid' pointers are NULL pointers
------------------------------- OCIDateTimeCompare-------------------------
sword OCIDateTimeCompare(dvoid *hndl, OCIError *err, CONST OCIDateTime *date1,
CONST OCIDateTime *date2, sword *result );
NAME: OCIDateTimeCompare - OCIDateTime CoMPare dates
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
date1, date2 (IN) - dates to be compared
type (IN) - Type of datetime to be compared. Both input datetimes
should be of same type.(OCI_DATE, OCI_TIME,
OCI_TIMESTAMP, OCI_TZTIMESTAMP, OCI_TZTIME)
result (OUT) - comparison result, 0 if equal, -1 if date1 < date2,
1 if date1 > date2
DESCRIPTION:
The function OCIDateCompare compares two dates. It returns -1 if
date1 is smaller than date2, 0 if they are equal, and 1 if date1 is
greater than date2.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
invalid date
input dates are not mutually comparable
------------------------------OCIDateTimeConvert----------------------
sword OCIDateTimeConvert(dvoid *hndl, OCIError *err, OCIDateTime *indate,
OCIDateTime *outdate);
NAME: OCIDateTimeConvert - Conversion between different DATETIME types
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
indate (IN) - pointer to input date
outdate (OUT) - pointer to output datetime
DESCRIPTION: Converts one datetime type to another. The result type is
the type of the 'outdate' descriptor.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
conversion not possible.
---------------------------- OCIDateTimeFromText-----------------------
sword OCIDateTimeFromText(dvoid *hndl, OCIError *err, CONST OraText *date_str,
size_t d_str_length, CONST OraText *fmt, ub1 fmt_length,
CONST OraText *lang_name, size_t lang_length,
OCIDateTime *date );
NAME: OCIDateTimeFromText - OCIDateTime convert String FROM Date
PARAMETERS:
hndl (IN) - Session/Env handle. If Session Handle is passed, the
conversion takes place in session NLS_LANGUAGE and
session NLS_CALENDAR, otherwise the default is used.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
date_str (IN) - input string to be converted to Oracle date
d_str_length (IN) - size of the input string, if the length is -1
then 'date_str' is treated as a null terminated string
fmt (IN) - conversion format; if 'fmt' is a null pointer, then
the string is expected to be in the default format for
the datetime type.
fmt_length (IN) - length of the 'fmt' parameter
lang_name (IN) - language in which the names and abbreviations of
days and months are specified, if null i.e. (OraText *)0,
the default language of session is used,
lang_length (IN) - length of the 'lang_name' parameter
date (OUT) - given string converted to date
DESCRIPTION:
Converts the given string to Oracle datetime type set in the
OCIDateTime descriptor according to the specified format. Refer to
"TO_DATE" conversion function described in "Oracle SQL Language
Reference Manual" for a description of format.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if
invalid format
unknown language
invalid input string
--------------------------- OCIDateTimeGetDate-------------------------
void OCIDateTimeGetDate(dvoid *hndl, OCIError *err, CONST OCIDateTime *date,
sb2 *year, ub1 *month, ub1 *day );
NAME: OCIDateTimeGetDate - OCIDateTime Get Date (year, month, day)
portion of DATETIME.
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
datetime (IN) - Pointer to OCIDateTime
year (OUT) - year value
month (OUT) - month value
day (OUT) - day value
--------------------------- OCIDateTimeGetTime ------------------------
void OCIDateTimeGetTime(dvoid *hndl, OCIError *err, OCIDateTime *datetime,
ub1 *hour, ub1 *min, ub1 *sec, ub4 *fsec);
NAME: OCIDateTimeGetTime - OCIDateTime Get Time (hour, min, second,
fractional second) of DATETIME.
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
datetime (IN) - Pointer to OCIDateTime
hour (OUT) - hour value
min (OUT) - minute value
sec (OUT) - second value
fsec (OUT) - Fractional Second value
--------------------------- OCIDateTimeGetTimeZoneOffset ----------------------
sword OCIDateTimeGetTimeZoneOffset(dvoid *hndl,OCIError *err,CONST
OCIDateTime *datetime,sb1 *hour,sb1 *minute);
NAME: OCIDateTimeGetTimeZoneOffset - OCIDateTime Get TimeZone (hour, minute)
portion of DATETIME.
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
datetime (IN) - Pointer to OCIDateTime
hour (OUT) - TimeZone Hour value
minute (OUT) - TimeZone Minute value
------------------------------OCIDateTimeIntervalAdd----------------------
sword OCIDateTimeIntervalAdd(dvoid *hndl, OCIError *err, OCIDateTime *datetime,
OCIInterval *inter, OCIDateTime *outdatetime);
NAME: OCIDateTimeIntervalAdd - Adds an interval to datetime
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
datetime (IN) - pointer to input datetime
inter (IN) - pointer to interval
outdatetime (IN) - pointer to output datetime. The output datetime
will be of same type as input datetime
DESCRIPTION:
Adds an interval to a datetime to produce a resulting datetime
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if:
resulting date is before Jan 1, -4713
resulting date is after Dec 31, 9999
------------------------------OCIDateTimeIntervalSub----------------------
sword OCIDateTimeIntervalSub(dvoid *hndl, OCIError *err, OCIDateTime *datetime,
OCIInterval *inter, OCIDateTime *outdatetime);
NAME: OCIDateTimeIntervalSub - Subtracts an interval from a datetime
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
datetime (IN) - pointer to input datetime
inter (IN) - pointer to interval
outdatetime (IN) - pointer to output datetime. The output datetime
will be of same type as input datetime
DESCRIPTION:
Subtracts an interval from a datetime and stores the result in a
datetime
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_INVALID_HANDLE if 'err' is NULL.
OCI_ERROR if:
resulting date is before Jan 1, -4713
resulting date is after Dec 31, 9999
--------------------------- OCIDateTimeConstruct-------------------------
sword OCIDateTimeConstruct(dvoid *hndl,OCIError *err,OCIDateTime *datetime,
sb2 year,ub1 month,ub1 day,ub1 hour,ub1 min,ub1 sec,ub4 fsec,
OraText *timezone,size_t timezone_length);
NAME: OCIDateTimeConstruct - Construct an OCIDateTime. Only the relevant
fields for the OCIDateTime descriptor types are used.
PARAMETERS:
hndl (IN) - Session/Env handle.
err (IN/OUT) - error handle. If there is an error, it is
recorded in 'err' and this function returns OCI_ERROR.
The error recorded in 'err' can be retrieved by calling
OCIErrorGet().
datetime (IN) - Pointer to OCIDateTime
year (IN) - year value
month (IN) - month value
day (IN) - day value
hour (IN) - hour value
min (IN) - minute value
sec (IN) - second value
fsec (IN) - Fractional Second value
timezone (IN) - Timezone string
timezone_length(IN) - Length of timezone string
DESCRIPTION:
Constructs a DateTime descriptor. The type of the datetime is the
type of the OCIDateTime descriptor. Only the relevant fields based
on the type are used. For Types with timezone, the date and time
fields are assumed to be in the local time of the specified timezone.
If timezone is not specified, then session default timezone is
assumed.
RETURNS:
OCI_SUCCESS if the function completes successfully.
OCI_ERROR if datetime is not valid.
--------------------------- OCIDateTimeSysTimeStamp---------------------
sword OCIDateTimeSysTimeStamp(dvoid *hndl, OCIError *err,
OCIDateTime *sys_date );
NAME: OCIDateTimeSysTimeStamp - Returns system date/time as a TimeStamp with
timezone
PARAMETERS:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -