OCILobGetLength
Purpose : You can call this function to return the length of a large object (LOB) in bytes.
Function syntax :
sword OCILobGetLength (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub4 *lenp );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | A pointer to an LOB locator. |
| lenp(OUT) | The returned length of the LOB, in bytes. |
Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.
OCILobRead
Purpose : You can call this function to read the content of a specified length from an LOB.
Function syntax :
sword OCILobRead (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub4 *amtp,
ub4 offset,
dvoid *bufp,
ub4 bufl,
dvoid *ctxp,
OCICallbackLobRead (cbfp)
( dvoid *ctxp,
CONST dvoid *bufp,
ub4 len,
ub1 piece
)
ub2 csid,
ub1 csfrm );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | A pointer to an LOB locator. |
| Amtp(IN/OUT) | The amount of input or output bytes. When the function is called, this parameter indicates the number of bytes to be read. After the function is executed, OBCI backfills the number of bytes that were actually read. |
| offset | A reserved parameter. |
| bufp(IN) | The pointer to the buffer that stores the data read. |
| bufl(IN) | The length of the buffer that stores the data read. |
| ctxp | The context pointer of the callback function. The value can be NULL. |
| cbfp | A callback function that can be registered as a function that can be called by each piece. |
| csid | The character set ID of the buffer data. |
| csfrm | The character set form of the buffer data. |
Return value : OCI_NEED_DATA is returned if the function call succeeded but the data reading has not completed. OCI_SUCCESS is returned after the data reading is completed OCI_ERROR is returned if the function call failed.
OCILobRead2()
Purpose : You can call this function to read the content of a specified length from an LOB. This function must be used for LOBs greater than 4 GB. You can choose to use the OCILobRead2() or OCILobRead() function for LOBs smaller than 4 GB. Note
This function is available only in OceanBase Database V2.2.76 and later versions.
Function syntax :
sword OCILobRead2 (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
oraub8 *byte_amtp,
oraub8 *char_amtp,
oraub8 offset,
void *bufp,
oraub8 bufl,
ub1 piece,
void *ctxp,
OCICallbackLobRead2 (cbfp)
( void *ctxp,
const void *bufp,
oraub8 lenp,
ub1 piecep
void **changed_bufpp,
oraub8 *changed_lenp
)
ub2 csid,
ub1 csfrm );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | A pointer to an LOB locator. |
| byte_amtp (IN/OUT) | The parameter indicates the number of bytes to read from the database when the value is IN. This parameter is always used for a field whose data type is BLOB or BFILE. For a field whose data type is CLOB or NCLOB, it is used only when char_amtp is 0. The parameter indicates the number of bytes read into the user buffer when the value is OUT. |
| char_amtp (IN/OUT) | The parameter indicates the maximum number of characters read into the user buffer when the value is IN. The parameter indicates the number of characters read into the user buffer when the value is OUT. |
| offset | A reserved parameter. |
| bufp(IN) | The pointer to the buffer that stores the data read. |
| bufl(IN) | The length of the buffer that stores the data read. |
| piece (IN) | A reserved parameter. |
| ctxp | The context pointer of the callback function. The value can be NULL. |
| bufp (IN/OUT) | A buffer pointer to a piece. |
| lenp (IN) | The length in bytes of the current piece in bufp. |
| piecep (IN) | Indicates whether the piece type is OCI_FIRST_PIECE, OCI_NEXT_PIECE, or OCI_LAST_PIECE. |
| changed_bufpp (OUT) | The address of a new buffer. The default old buffer, that is, the buffer that the bufp parameter points to, is used if this parameter is set to NULL. |
| changed_lenp (OUT) | The length of the new buffer. |
| cbfp | A callback function that can be registered as a function that can be called by each piece. |
| csid | The character set ID of the buffer data. |
| csfrm | The character set form of the buffer data. |
Return value : OCI_NEED_DATA is returned if the function call succeeded but the data reading has not completed. OCI_SUCCESS is returned after the data reading is completed OCI_ERROR is returned if the function call failed.
OCILobWrite
Purpose : You can call this function to continuously write content into an LOB.
Function syntax :
sword OCILobWrite (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub4 *amtp,
ub4 offset,
void *bufp,
ub4 buflen,
ub1 piece,
void *ctxp,
OCICallbackLobWrite (cbfp)
(
void *ctxp,
void *bufp,
ub4 *lenp,
ub1 *piecep
)
ub2 csid,
ub1 csfrm );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | A pointer to an LOB locator. |
| amtp(IN/OUT) | The amount of input or output bytes. When the function is called, this parameter indicates the number of bytes to be read. After the function is executed, OBCI backfills the number of bytes that were actually read. |
| offset | A reserved parameter. |
| bufp(IN) | The pointer to the buffer that stores the data read. |
| buflen(IN) | The length of the buffer that stores the data read. |
| piece | A reserved parameter. |
| ctxp | A reserved parameter. |
| cbfp | A reserved parameter. |
| csid | A reserved parameter. |
| csfrm | A reserved parameter. |
Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.
OCILobLocatorIsInit
Purpose : You can call this function to verify whether the given LOB or BFILE locator has been initialized.
Function syntax :
sword OCILobLocatorIsInit (
OCIEnv *envhp,
OCIError *errhp,
const OCILobLocator *locp,
boolean *is_initialized );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN/OUT) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | An LOB or BFILE locator. |
| is_initialized (OUT) | Returns TRUE if the given LOB or BFILE locator has been initialized, and FALSE if otherwise. |
Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.
OCILobOpen
Purpose : You can call this function to open an LOB or BFILE object.
Function syntax :
sword OCILobOpen (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub1 mode );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN/OUT) | An LOB or BFILE locator. |
| mode (IN) | The opening mode. |
Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.
OCILobClose
Purpose : You can call this function to close an LOB or BFILE object.
Function syntax :
sword OCILobClose (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN/OUT) | An LOB or BFILE locator. |
Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.
OCILobIsOpen
Purpose : You can call this function to test whether an LOB or FILE object is open.
Function syntax :
sword OCILobIsOpen (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
boolean *flag );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | An LOB or FILE locator. |
| flag(OUT) | Returns TRUE if the LOB or FILE object is open, or FALSE if otherwise. |
Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.
OCILobTrim
Purpose : You can call this function to trim an LOB value to a shorter length.
Function syntax :
sword OCILobTrim (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub4 newlen );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | An LOB or FILE locator. |
| newlen(IN) | The new length of the LOB value, which must be shorter than or equal to the current length. For character LOBs, it indicates the number of characters, and for binary LOBs and BFILEs, it indicates the number of bytes in the LOB. |
Return value : OCI_SUCCESS is returned if the function call succeeded, or OCI_ERROR is returned if the function call failed.
OCILobTrim2
Purpose : You can call this function to trim an LOB value to a shorter length. This function must be used for LOBs greater than 4 GB. You can also use this function for LOBs smaller than 4 GB.
Function syntax :
sword OCILobTrim2 (
OCISvcCtx *svchp,
OCIError *errhp,
OCILobLocator *locp,
ub4 newlen );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A pointer to a context handle. |
| errhp(IN/OUT) | An error handle. |
| locp(IN) | An LOB or FILE locator. |
| newlen(IN) | The new length of the LOB value, which must be shorter than or equal to the current length. For character LOBs, it indicates the number of characters, and for binary LOBs and BFILEs, it indicates the number of bytes in the LOB. |
Return value : OCI_SUCCESS is returned if the function call succeeded, and OCI_ERROR is returned if the function call failed.