⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ociap.h

📁 能够连接各种数据库的API
💻 H
📖 第 1 页 / 共 5 页
字号:
        "Oracle SQL Language Reference Manual" for a description of format        and NLS arguments. The converted null-terminated date string is        stored in the buffer 'buf'.RETURNS:        OCI_SUCCESS if the function completes successfully.        OCI_INVALID_HANDLE if 'err' is NULL.        OCI_ERROR if  	  buffer too small  	  invalid format  	  unknown language          overflow error------------------------------OCIDefineArrayOfStruct--------------------------OCIDefineArrayOfStruct()NameOCI Define for Array of StructuresPurposeThis call specifies additional attributes necessary for a static array define.Syntaxsword OCIDefineArrayOfStruct ( OCIDefine   *defnp,                             OCIError    *errhp,                             ub4         pvskip,                              ub4         indskip,                              ub4         rlskip,                             ub4         rcskip );CommentsThis call specifies additional attributes necessary for an array define, used in an array of structures (multi-row, multi-column) fetch.For more information about skip parameters, see the section "Skip Parameters" on page 4-17.Parametersdefnp (IN) - the handle to the define structure which was returned by a call to OCIDefineByPos().errhp (IN) - an error handle which can be passed to OCIErrorGet() for diagnostic information in the event of an error.pvskip (IN) - skip parameter for the next data value.indskip (IN) - skip parameter for the next indicator location. rlskip (IN) - skip parameter for the next return length value.rcskip (IN) - skip parameter for the next return code.Related FunctionsOCIAttrGet()OCIDefineByPos()NameOCI Define By PositionPurposeAssociates an item in a select-list with the type and output data buffer. Syntaxsb4 OCIDefineByPos (               OCIStmt     *stmtp,               OCIDefine   **defnp,              OCIError    *errhp,              ub4         position,              dvoid       *valuep,              sb4         value_sz,              ub2         dty,              dvoid       *indp,              ub2         *rlenp,              ub2         *rcodep,              ub4         mode );CommentsThis call defines an output buffer which will receive data retreived from Oracle. The define is a local step which is necessary when a SELECT statement returns data to your OCI application.This call also implicitly allocates the define handle for the select-list item.Defining attributes of a column for a fetch is done in one or more calls. The first call is to OCIDefineByPos(), which defines the minimal attributes required to specify the fetch. This call takes as a parameter a define handle, which must have been previously allocated with a call to OCIHandleAlloc().Following the call to OCIDefineByPos() additional define calls may be necessary for certain data types or fetch modes:A call to OCIDefineArrayOfStruct() is necessary to set up skip parameters for an array fetch of multiple columns.A call to OCIDefineObject() is necessary to set up the appropriate attributes of a named data type fetch. In this case the data buffer pointer in ocidefn() is ignored.Both OCIDefineArrayOfStruct() and OCIDefineObject() must be called after ocidefn() in order to fetch multiple rows with a column of named data types.For a LOB define, the buffer pointer must be a lob locator of type OCILobLocator , allocated by the OCIDescAlloc() call. LOB locators, and not LOB values, are always returned for a LOB column. LOB values can then be fetched using OCI LOB calls on the fetched locator.For NCHAR (fixed and varying length), the buffer pointer must point to an array of bytes sufficient for holding the required NCHAR characters. Nested table columns are defined and fetched like any other named data type. If the mode parameter is this call is set to OCI_DYNAMIC_FETCH, the client application can fetch data dynamically at runtime.Runtime data can be provided in one of two ways:callbacks using a user-defined function which must be registered with a subsequent call to OCIDefineDynamic(). When the client library needs a buffer to return the fetched data, the callback will be invoked and the runtime buffers provided will return a piece or the whole data. a polling mechanism using calls supplied by the OCI. This mode is assumed if no callbacks are defined. In this case, the fetch call returns the OCI_NEED_DATA error code, and a piecewise polling method is used to provide the data.Related Functions: For more information about using the OCI_DYNAMIC_FETCH mode, see the section "Runtime Data Allocation and Piecewise Operations" on page 5-16 of Volume 1..For more information about the define step, see the section "Defining" on page 2-30.Parametersstmtp (IN) - a handle to the requested SQL query operation.defnp (IN/OUT) - a pointer to a pointer to a define handle which is implicitly allocated by this call.  This handle is used to  store the define information for this column.errhp (IN) - an error handle which can be passed to OCIErrorGet() for diagnostic information in the event of an error.position (IN) - the position of this value in the select list. Positions are 1-based and are numbered from left to right. For example, in the SELECT statementSELECT empno, ssn, mgrno FROM employees;empno is at position 1, ssn is at position 2, and mgrno is at position 3.valuep (IN/OUT) - a pointer to a buffer or an array of buffers of the type specified in the dty parameter. A number of buffers can be specified when results for more than one row are desired in a single fetch call.value_sz (IN) - the size of each valuep buffer in bytes. If the data is stored internally in VARCHAR2 format, the number of characters desired, if different from the buffer size in bytes, may be additionally specified by the using OCIAttrSet(). In an NLS conversion environment, a truncation error will be generated if the number of bytes specified is insufficient to handle the number of characters desired.dty (IN) - the data type. Named data type (SQLT_NTY) and REF (SQLT_REF) are valid only if the environment has been intialized with in object mode. indp - pointer to an indicator variable or array. For scalar data types, pointer to sb2 or an array of sb2s. Ignored for named data types. For named data types, a pointer to a named data type indicator structure or an array of named data type indicator structures is associated by a subsequent OCIDefineObject() call. See the section "Indicator Variables" on page 2-43 for more information about indicator variables.rlenp (IN/OUT) - pointer to array of length of data fetched. Each element in rlenp is the length of the data in the corresponding element in the row after the fetch. rcodep (OUT) - pointer to array of column-level return codesmode (IN) - the valid modes are:OCI_DEFAULT. This is the default mode.OCI_DYNAMIC_FETCH. For applications requiring dynamically allocated data at the time of fetch, this mode must be used. The user may additionally call OCIDefineDynamic() to set up a callback function that will be invoked to receive the dynamically allocated buffers and to set up the memory allocate/free callbacks and the context for the callbacks. valuep and value_sz are ignored in this mode. Related FunctionsOCIDefineArrayOfStruct(), OCIDefineDynamic(), OCIDefineObject()OCIDefineDynamic()NameOCI Define Dynamic Fetch AttributesPurposeThis call is used to set the additional attributes required if the OCI_DYNAMIC_FETCH mode was selected in OCIDefineByPos(). Syntaxsword OCIDefineDynamic( OCIDefine   *defnp,                      OCIError    *errhp,                      dvoid       *octxp,                       OCICallbackDefine (ocbfp)(                                  dvoid             *octxp,                                  OCIDefine         *defnp,                                  ub4               iter,                                   dvoid             **bufpp,                                  ub4               **alenpp,                                  ub1               *piecep,                                  dvoid             **indpp,                                  ub2               **rcodep)  );CommentsThis call is used to set the additional attributes required if the OCI_DYNAMIC_FETCH mode has been selected in a call to OCIDefineByPos(). When the OCI_DYNAMIC_FETCH mode is selected, buffers will be dynamically allocated for REF, and named data type, values to receive the data. The pointers to these buffers will be returned. If OCI_DYNAMIC_FETCH mode was selected, and the call to OCIDefineDynamic() is skipped, then the application can fetch data piecewise using OCI calls.For more information about OCI_DYNAMIC_FETCH mode, see the section "Runtime Data Allocation and Piecewise Operations" on page 5-16.Parametersdefnp (IN/OUT) - the handle to a define structure returned by a call to OCIDefineByPos().errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for diagnostic information in the event of an error. octxp (IN) - points to a context for the callback function. ocbfp (IN) - points to a callback function. This is invoked at runtime to get a pointer to the buffer into which the fetched data or a piece of it will be retreived. The callback also specifies the indicator, the return code and the lengths of the data piece and indicator. The callback has the following parameters:octxp (IN) - a context pointer passed as an argument to all the callback functions.defnp (IN) - the define handle.iter (IN) - which row of this current fetch.bufpp (OUT) - returns a pointer to a buffer to store the column value, ie. *bufp points to some appropriate storage for the column value.alenpp (OUT) - returns a pointer to the length of the buffer. *alenpp contains the size of the buffer after return from callback. Gets set to actual data size after fetch.piecep (IN/OUT) - returns a piece value, as follows:The IN value can be OCI_ONE_PIECE, OCI_FIRST_PIECE or OCI_NEXT_PIECE.The OUT value can be OCI_ONE_PIECE if the IN value was OCI_ONE_PIECE.The OUT value can be OCI_ONE_PIECE or OCI_FIRST_PIECE if the IN value was OCI_FIRST_PIECE.The OUT value can only be OCI_NEXT_PIECE or OCI_LAST_PIECE if the IN value was OCI_NEXT_PIECE. indpp (IN) - indicator variable pointerrcodep (IN) - return code variable pointerRelated FunctionsOCIAttrGet()OCIDefineObject()OCIDefineObject()NameOCI Define Named Data Type attributesPurposeSets up additional attributes necessary for a Named Data Type define.Syntaxsword OCIDefineObject ( OCIDefine       *defnp,                      OCIError        *errhp,                      CONST OCIType   *type,                      dvoid           **pgvpp,                       ub4             *pvszsp,                       dvoid           **indpp,                       ub4             *indszp );CommentsThis call sets up additional attributes necessary for a Named Data Type define.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().See the description of OCIInitialize() on page 13 - 43 for more information about initializing the OCI process environment.Parametersdefnp (IN/OUT) - a define handle previously allocated in a call to OCIDefineByPos(). errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for diagnostic information in the event of an error.type (IN, optional) - points to the Type Descriptor Object (TDO) which describes the type of the program variable. Only used for program variables of type SQLT_NTY. This parameter is optional, and may be passed as NULL if it is not being used.pgvpp (IN/OUT) - points to a pointer to a program variable buffer. For an array, pgvpp points to an array of pointers. Memory for the fetched named data type instance(s) is dynamically allocated in the object cache. At the end of the fetch when all the values have been received, pgvpp points to the pointer(s) tothese newly allocated named data type instance(s). The application must call OCIObjectMarkDel() to deallocate the named data type instance(s) when they are no longer needed. pvszsp (IN/OUT) - points to the size of the program variable. For an array, it is an array of ub4s. On return points to the size(s) of unpickled fetched values.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. Memory is allocated to store the indicator structures in the object cache. At the end of the fetch when all values have been received, indpp points to the pointer(s) to these newly allocated indicator structure

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -