String functions

2023-06-29 06:42:03  Updated

#docslug#/obci/obci/V2.0.2/ycgzns

OCIStringAllocSize

Description : You can call this function to get the allocated size of string memory in bytes or code points (Unicode).

Function prototype :

sword OCIStringAllocSize ( 
OCIEnv              *env,
OCIError            *err,
const OCIString     *vs,
ub4                 *allocsize );

Parameters :

Parameter Description
env (IN/OUT) A pointer to a service context handle.
err(IN/OUT) An error handle.
vs(IN) Returns a string whose allocated size is measured in bytes. vs must be a non-NULL pointer.
allocsize(OUT) Returns the allocated size of string memory in bytes.

Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.

OCIStringAssign

Description : You can call this function to assign the source text string to the target string.

Function prototype :

sword OCIStringAssign ( 
OCIEnv               *env,
OCIError             *err,
const OCIString      *rhs,
OCIString            **lhs );

Parameters :

Parameter Description
env (IN/OUT) A pointer to a service context handle.
err(IN/OUT) An error handle.
rhs(IN) The right-hand side (source string) of the assignment.
lhs(IN/OUT) The left-hand side (target string) of the assignment.

Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.

OCIStringAssignText

Description : You can call this function to assign the source text string to the target string.

Function prototype :

sword OCIStringAssignText ( 
OCIEnv           *env,
OCIError         *err,
const OraText    *rhs,
ub4              rhs_len,
OCIString        **lhs );

Parameters :

Parameter Description
env (IN/OUT) A pointer to a service context handle.
err(IN/OUT) An error handle.
rhs(IN) The right-hand side (source string) of the assignment.
rhs_len(IN) The length of the string.
lhs(IN/OUT) The left-hand side (target string) of the assignment.

Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.

OCIStringPtr

Description : You can call this function to get the pointer to the text of a given string.

Function prototype :

text *OCIStringPtr ( 
OCIEnv               *env,
const OCIString      *vs );

Parameters :

Parameter Description
env (IN/OUT) A pointer to a service context handle.
vs(IN) The pointer to the OCIString object whose character string is to be returned. If the encoding of vs is UTF-16, that of the returned buffer is also UTF-16. To know the encoding of the returned buffer, check UTF-16 information in OCIString vs. This is because a particular OCIString may not have the same settings as the env does. The check function should be an object OCI function that is designed to check member fields in objects.

Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.

OCIStringSize

Description : You can call this function to get the size of the pointer text of a given string.

Function prototype :

ub4 OCIStringSize ( 
OCIEnv              *env,
const OCIString     *vs );

Parameters :

Parameter Description
env (IN/OUT) A pointer to a service context handle.
vs(IN) Returns the size of the string in bytes.

Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.

OCIStringResize

Description : You can call this function to resize the memory of a given string.

Function prototype :

sword OCIStringResize ( 
OCIEnv          *env,
OCIError        *err,
ub4             new_size,
OCIString       **str );

Parameters :

Parameter Description
env (IN/OUT) A pointer to a service context handle.
err(IN/OUT) An error handle.
new_size(IN) The new memory size of the string, in bytes. new_size must include space for the NULL character as the string terminator.
str(IN/OUT) The memory that is allocated for the string and freed from the OCI object cache.

Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.

Contact Us