📄 ociap.h
字号:
mode (IN) - the valid modes for this parameter are:
OCI_DEFAULT. This is default mode.
OCI_DATA_AT_EXEC. When this mode is selected, the value_sz
parameter defines the maximum size of the data that can be ever
provided at runtime. The application must be ready to provide the OCI
library runtime IN data buffers at any time and any number of times.
Runtime data is provided in one of the two ways:
callbacks using a user-defined function which must be registered
with a subsequent call to OCIBindDynamic() .
a polling mechanism using calls supplied by the OCI. This mode
is assumed if no callbacks are defined.
For more information about using the OCI_DATA_AT_EXEC mode, see
the section "Runtime Data Allocation and Piecewise Operations" on
page 5-16.
When the allocated buffers are not required any more, they should be
freed by the client.
Related Functions
OCIBindDynamic(), OCIBindObject(), OCIBindArrayOfStruct(), OCIAttrGet()
-------------------------------OCIBindDynamic---------------------------------
OCIBindDynamic()
Name
OCI Bind Dynamic Attributes
Purpose
This call is used to register user callbacks for dynamic data allocation.
Syntax
sword OCIBindDynamic( OCIBind *bindp,
OCIError *errhp,
dvoid *ictxp,
OCICallbackInBind (icbfp)(
dvoid *ictxp,
OCIBind *bindp,
ub4 iter,
ub4 index,
dvoid **bufpp,
ub4 *alenp,
ub1 *piecep,
dvoid **indp ),
dvoid *octxp,
OCICallbackOutBind (ocbfp)(
dvoid *octxp,
OCIBind *bindp,
ub4 iter,
ub4 index,
dvoid **bufp,
ub4 **alenpp,
ub1 *piecep,
dvoid **indpp,
ub2 **rcodepp) );
Comments
This call is used to register user-defined callback functions for providing
data for an UPDATE or INSERT if OCI_DATA_AT_EXEC mode was specified in a
previous call to OCIBindByName() or OCIBindByPos().
The callback function pointers must return OCI_CONTINUE if it the call is
successful. Any return code other than OCI_CONTINUE signals that the client
wishes to abort processing immediately.
For more information about the OCI_DATA_AT_EXEC mode, see the section
"Runtime Data Allocation and Piecewise Operations" on page 5-16.
Parameters
bindp (IN/OUT) - a bind handle returned by a call to OCIBindByName() or
OCIBindByPos().
errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for
diagnostic information in the event of an error.
ictxp (IN) - the context pointer required by the call back function icbfp.
icbfp (IN) - the callback function which returns a pointer to the IN bind
value or piece at run time. The callback takes in the following parameters.
ictxp (IN/OUT) - the context pointer for this callback function.
bindp (IN) - the bind handle passed in to uniquely identify this bind
variable.
iter (IN) - 1-based execute iteration value.
index (IN) - index of the current array, for an array bind. 1 based not
greater than curele parameter of the bind call.
index (IN) - index of the current array, for an array bind. This parameter
is 1-based, and may not be greater than curele parameter of the bind call.
bufpp (OUT) - the pointer to the buffer.
piecep (OUT) - which piece of the bind value. This can be one of the
following values - OCI_ONE_PIECE, OCI_FIRST_PIECE,
OCI_NEXT_PIECE and OCI_LAST_PIECE.
indp (OUT) - contains the indicator value. This is apointer to either an
sb2 value or a pointer to an indicator structure for binding named data
types.
indszp (OUT) - contains the indicator value size. A pointer containing
the size of either an sb2 or an indicator structure pointer.
octxp (IN) - the context pointer required by the callback function ocbfp.
ocbfp (IN) - the callback function which returns a pointer to the OUT bind
value or piece at run time. The callback takes in the following parameters.
octxp (IN/OUT) - the context pointer for this call back function.
bindp (IN) - the bind handle passed in to uniquely identify this bind
variable.
iter (IN) - 1-based execute iteration value.
index (IN) - index of the current array, for an array bind. This parameter
is 1-based, and must not be greater than curele parameter of the bind call.
bufpp (OUT) - a pointer to a buffer to write the bind value/piece.
buflp (OUT) - returns the buffer size.
alenpp (OUT) - a pointer to a storage for OCI to fill in the size of the bind
value/piece after it has been read.
piecep (IN/OUT) - which piece of the bind value. It will be set by the
library to be one of the following values - OCI_ONE_PIECE or
OCI_NEXT_PIECE. The callback function can leave it unchanged or set
it to OCI_FIRST_PIECE or OCI_LAST_PIECE. By default -
OCI_ONE_PIECE.
indpp (OUT) - returns a pointer to contain the indicator value which
either an sb2 value or a pointer to an indicator structure for named data
types.
indszpp (OUT) - returns a pointer to return the size of the indicator
value which is either size of an sb2 or size of an indicator structure.
rcodepp (OUT) - returns a pointer to contains the return code.
Related Functions
OCIAttrGet()
---------------------------------OCIBindObject--------------------------------
OCIBindObject()
Name
OCI Bind Object
Purpose
This function sets up additional attributes which are required for a named
data type (object) bind.
Syntax
sword OCIBindObject ( OCIBind *bindp,
OCIError *errhp,
CONST OCIType *type,
dvoid **pgvpp,
ub4 *pvszsp,
dvoid **indpp,
ub4 *indszp, );
Comments
This function sets up additional attributes which binding a named data type
or a REF. An error will be returned if this function is called when the OCI
environment has been initialized in non-object mode.
This call takes as a paramter a type descriptor object (TDO) of datatype
OCIType for the named data type being defined. The TDO can be retrieved
with a call to OCITypeByName().
If the OCI_DATA_AT_EXEC mode was specified in ocibindn() or ocibindp(), the
pointers to the IN buffers are obtained either using the callback icbfp
registered in the OCIBindDynamic() call or by the OCIStmtSetPieceInfo() call.
The buffers are dynamically allocated for the OUT data and the pointers to
these buffers are returned either by calling ocbfp() registered by the
OCIBindDynamic() or by setting the pointer to the buffer in the buffer passed
in by OCIStmtSetPieceInfo() called when OCIStmtExecute() returned
OCI_NEED_DATA. The memory of these client library- allocated buffers must be
freed when not in use anymore by using the OCIObjectFreee() call.
Parameters
bindp ( IN/OUT) - the bind handle returned by the call to OCIBindByName()
or OCIBindByPos().
errhp ( IN/OUT) - an error handle which can be passed to OCIErrorGet() for
diagnostic information in the event of an error.
type ( IN) - points to the TDO which describes the type of the program
variable being bound. Retrieved by calling OCITypeByName().
pgvpp ( IN/OUT) - points to a pointer to the program variable buffer. For an
array, pgvpp points to an array of pointers. When the bind variable is also an
OUT variable, the OUT Named Data Type value or REF is allocated
(unpickled) in the Object Cache, and a pointer to the value or REF is returned,
At the end of execute, when all OUT values have been received, pgvpp points
to an array of pointer(s) to these newly allocated named data types in the
object cache.
pgvpp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the Named
Data Type buffers are requested at runtime. For static array binds, skip
factors may be specified using the OCIBindArrayOfStruct() call. The skip
factors are used to compute the address of the next pointer to the value, the
indicator structure and their sizes.
pvszsp ( IN/OUT) - points to the size of the program variable. The size of the
named data type is not required on input. For an array, pvszsp is an array of
ub4s. On return, for OUT bind variables, this points to size(s) of the Named
Data Types and REFs received. pvszsp is ignored if the OCI_DATA_AT_EXEC
mode is set. Then the size of the buffer is taken at runtime.
indpp ( IN/OUT) - points to a pointer to the program variable buffer
containing the parallel indicator structure. For an array, points to an array of
pointers. When the bind variable is also an OUT bind variable, memory is
allocated in the object cache, to store the unpickled OUT indicator values. At
the end of the execute when all OUT values have been received, indpp points
to the pointer(s) to these newly allocated indicator structure(s).
indpp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the indicator
is requested at runtime.
indszp ( IN/OUT) - points to the size of the IN indicator structure program
variable. For an array, it is an array of sb2s. On return for OUT bind variables,
this points to size(s) of the received OUT indicator structures.
indszp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the indicator
size is requested at runtime.
Related Functions
OCIAttrGet()
----------------------------------OCIBreak------------------------------------
OCIBreak()
Name
OCI Break
Purpose
This call performs an immediate (asynchronous) abort of any currently
executing OCI function that is associated with a server .
Syntax
sword OCIBreak ( dvoid *hndlp,
OCIError *errhp);
Comments
This call performs an immediate (asynchronous) abort of any currently
executing OCI function that is associated with a server. It is normally used
to stop a long-running OCI call being processed on the server.
This call can take either the service context handle or the server context
handle as a parameter to identify the function to be aborted.
Parameters
hndlp (IN) - the service context handle or the server context handle.
errhp (IN) - an error handle which can be passed to OCIErrorGet() for
diagnostic information in the event of an error.
Related Functions
------------------------------OCIDateTimeAssign --------------------------
sword OCIDateTimeAssign(dvoid *hndl, OCIError *err, CONST OCIDateTime *from,
OCIDateTime *to);
NAME: OCIDateTimeAssign - OCIDateTime Assignment
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().
from (IN) - datetime to be assigned
to (OUT) - lhs of assignment
DESCRIPTION:
Performs date assignment. The type of the output will be same as that
of input
------------------------------OCIDateTimeCheck----------------------------
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
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -