📄 ocikp.h
字号:
position (IN) - the placeholder attributes are specified by position if ocibindp()
is being called.
valuep (IN/OUT) - a pointer to a data value or an array of data values of the
type specified in the dty parameter. An array of data values can be specified
for mapping into a PL/SQL table or for providing data for SQL multiple-row
operations. When an array of bind values is provided, this is called an array
bind in OCI terms. Additional attributes of the array bind (not bind to a
column of ARRAY type) are set up in OCIBindArrayOfStruct() call.
For a REF, named data type bind, the valuep parameter is used only for IN
bind data. The pointers to OUT buffers are set in the pgvpp parameter
initialized by OCIBindObject(). For named data type and REF binds, the bind
values are unpickled into the Object Cache. The OCI object navigational calls
can then be used to navigate the objects and the refs in the Object Cache.
If the OCI_DATA_AT_EXEC mode is specified in the mode parameter, valuep
is ignored for all data types. OCIBindArrayOfStruct() cannot be used and
OCIBindDynamic() must be invoked to provide callback functions if desired.
value_sz (IN) - the size of a data value. In the case of an array bind, this is the
maximum size of any element possible with the actual sizes being specified in
the alenp parameter.
If the OCI_DATA_AT_EXEC mode is specified, valuesz defines the maximum
size of the data that can be ever provided at runtime for data types other than
named data types or REFs.
dty (IN) - the data type of the value(s) being bound. Named data types
(SQLT_NTY) and REFs (SQLT_REF) are valid only if the application has been
initialized in object mode. For named data types, or REFs, additional calls
must be made with the bind handle to set up the datatype-specific attributes.
indp (IN/OUT) - pointer to an indicator variable or array. For scalar data
types, this is a pointer to sb2 or an array of sb2s. For named data types,
this pointer is ignored and the actual pointer to the indicator structure or
an array of indicator structures is initialized by OCIBindObject(). Ignored
for dynamic binds.
See the section "Indicator Variables" on page 2-43 for more information about
indicator variables.
alenp (IN/OUT) - pointer to array of actual lengths of array elements. Each
element in alenp is the length of the data in the corresponding element in the
bind value array before and after the execute. This parameter is ignored for
dynamic binds.
rcodep (OUT) - pointer to array of column level return codes. This parameter
is ignored for dynamic binds.
maxarr_len (IN) - the maximum possible number of elements of type dty in a
PL/SQL binds. This parameter is not required for non-PL/SQL binds. If
maxarr_len is non-zero, then either OCIBindDynamic() or
OCIBindArrayOfStruct() can be invoked to set up additional bind attributes.
curelep(IN/OUT) - a pointer to the actual number of elements. This parameter
is only required for PL/SQL binds.
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
-----------------------------OCIConnectionPoolCreate --------------------------
Name:
OCIConnectionPoolCreate
Purpose:
Initializes the Connection Pool
Syntax:
OCIConnectionPoolCreate (OCIEnv *envhp, OCIError *errhp, OCICPool *poolhp,
OraText **poolName, sb4 *poolNameLen,
CONST Oratext *dblink, sb4 dblinkLen,
ub4 connMin, ub4 connMax, ub4 connIncr,
CONST OraText *poolUsername, sb4 poolUserLen,
CONST OraText *poolPassword, sb4 poolPassLen, ub4 mode)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -