📄 ociap.h
字号:
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 FunctionsOCIBindDynamic(), OCIBindObject(), OCIBindArrayOfStruct(), OCIAttrGet()-------------------------------OCIBindDynamic---------------------------------OCIBindDynamic()NameOCI Bind Dynamic AttributesPurposeThis call is used to register user callbacks for dynamic data allocation. Syntaxsword 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) );CommentsThis 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.Parametersbindp (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 FunctionsOCIAttrGet()---------------------------------OCIBindObject--------------------------------OCIBindObject()NameOCI Bind ObjectPurposeThis function sets up additional attributes which are required for a named data type (object) bind.Syntaxsword OCIBindObject ( OCIBind *bindp, OCIError *errhp, CONST OCIType *type, dvoid **pgvpp, ub4 *pvszsp, dvoid **indpp, ub4 *indszp, );CommentsThis 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.Parametersbindp ( 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 FunctionsOCIAttrGet()----------------------------------OCIBreak------------------------------------OCIBreak()NameOCI BreakPurposeThis call performs an immediate (asynchronous) abort of any currently executing OCI function that is associated with a server .Syntaxsword OCIBreak ( dvoid *hndlp, OCIError *errhp);CommentsThis 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.Parametershndlp (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:OCIConnectionPoolCreatePurpose:Creates the connections in the poolSyntax: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)Comments:This call is used to create a connection pool. conn_min connectionsto the database are started on calling OCIConnectionPoolCreate.Parameters:envhp (IN/OUT) - A pointer to the environment where the Conencton Pool is to be createderrhp (IN/OUT) - An error handle which can be passed to OCIErrorGet().poolhp (IN/OUT) - An uninitialiazed pool handle.poolName (OUT) - The connection pool name. poolNameLen (OUT) - The length of the connection pool name dblink (IN/OUT) - Specifies the database(server) to connect. This will also be used as the default pool name.dblinkLen (IN) - The length of the string pointed to by dblink.connMin (IN) - Specifies the minimum number of connections in the Connection Pool at any instant. connMin number of connections are started when OCIConnectionPoolCreate() is called.connMax (IN) - Specifies the maximum number of connections that can be opened to the database. Once this value is reached, no more connections are opened.connIncr (IN) - Allows application to set the next increment for connections to be opened to the database if the current number of connections are less than conn_max.poolUsername (IN/OUT) - Connection pooling requires an implicit proxy session and this attribute provides a username for that session.poolUserLen (IN) - This represents the length of pool_username.poolPassword (IN/OUT) - The password for the parameter pool_username passed above.poolPassLen (IN) - This represents the length of pool_password.mode (IN) - The modes supported are OCI_DEFAULT and OCI_REINITIALIZERelated FunctionsOCIConnectionPoolDestroy()-------------------------------------------------------------------------------------------------------OCIConnectionPoolDestroy-------------------------Name:OCIConnectionPoolDestroyPurpose:Terminates the connections in the poolSyntax:OCIConnectionPoolDestroy (OCICPool *poolhp, OCIError *errhp, ub4 mode)Comments:On calling OCIConnectionPoolDestroy, all the open connections in the poolare closed and the pool is destroyed.Parameters:poolhp (IN/OUT) - An initialiazed pool handle.errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet().mode (IN) - Currently, OCIConnectionPoolDestroy() will support only the OCI_DEFAULT mode.Related Functions:OCIConnectionPoolCreate()-----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -