sqludf_free_locator()--SQL LOB Free Locator
Syntax
#include <sqludf.h>
extern int SQL_API_FN sqludf_free_locator(
udf_locator * udfloc_p)
Service Program Name: QSYS/QSQAPISDefault Public Authority: *USE
Threadsafe: Yes
The sqludf_free_locator() function frees a LOB locator.
Parameters
- udfloc_p
- (Input) Pointer to the LOB locator value.
Authorities
No authorization is required.
Return Value
sqludf_free_locator()returns an integer. Possible values are:
- 0
- sqludf_free_locator() was successful.
- -3
- sqludf_free_locator() was not successful. An invalid pointer was passed into the function.
- -423
- sqludf_free_locator() was not successful. The udfloc_p parameter
points to an invalid locator value.
- -901
- sqludf_free_locator() was not successful. An SQL system error has occurred.
- -7034
- sqludf_free_locator() was not successful. LOB locators are not allowed with COMMIT(*NONE).
Error Messages
| Message ID | Error Message Text |
|---|---|
| SQL7034 D | LOB locators are not allowed with COMMIT(*NONE). |
| SQL0901 D | SQL system error. |
| SQL0952 D | Processing of the SQL statement ended. |
| CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
Usage Notes
- This API is used to free a LOB locator.
Related Information
- sqludf_append()--SQL LOB append locator
- sqludf_create_locator()--SQL LOB create locator
- sqludf_create_locator_with_ccsid()--SQL LOB create locator with ccsid
- sqludf_length()--SQL LOB locator length
- sqludf_substr()--SQL LOB substring locator
Example
This example creates a CLOB locator and then frees the locator. The operations performed with the locator are left to the user to add.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sql.h>
#include <sqludf.h>
int main(int argc, char* argv[])
{
int rc; /* return code variable for API calls */
udf_locator * udfloc_p; /* pointer to locator */
udf_locator locator; /* locator value */
udfloc_p = &locator; /* set address to locator */
/* Create the locator */
rc = sqludf_create_locator(SQL_TYP_CLOB, &udfloc_p);
if (rc) {
/* If create locator returned an error then return now */
goto exit;
}
/* Perform operations using the locator */
/* Free the locator */
rc = sqludf_free_locator(udfloc_p);
if (rc) {
/* If free locator returned an error then return now */
goto exit;
}
exit: /* used for errors, which will override null-ness of output. */
return rc;
}
Referring to this code, observe that:
- There are includes for sql.h, where the type
SQL_TYP_CLOBused in thesqludf_create_locator()call is defined, andsqludf.h, where the typeudf_locatoris defined.
This is an example of using the sqludf_free_locator API to free a locator.
API introduced: V5R3