1. Introduction : OpenAPI Concepts and Processes : How Unformatted Data is Handled : LOB Locators
 
Share this page                  
LOB Locators
Rather than retrieving long data along with other query data, an application can request a reference to the long data, called a locator, by setting the IIAPI_QF_LOCATOR flag when calling IIapi_query().  Locators are 4-byte integer values that reference the long data where it resides in the database.  A locator value is only valid on the connection and during the transaction in which it is received.
A locator may be used to retrieve the referenced data by issuing the following query:
select ~V
The locator value is provided as a query parameter using IIapi_setDescriptor() and IIapi_putParams(). (See Query Parameters for details on ~V parameter markers.) To ensure the long data is returned, the IIAPI_QF_LOCATOR flag should not be set for this query. The long data is then received and processed in segments as described above.
In addition to retrieving the referenced long data, locators can also be used to operate on the long data as it resides in the database. A ~V query marker and locator query parameter can be used in SQL statements in places where long data references are permitted. In particular, the following statements provide access to long data while it resides in the database:
select length( ~V )
select substring( ~V from start for length )
select position( pattern, ~V , start )