Scalable Database Server, HiRDB Version 8 Description

[Contents][Glossary][Index][Back][Next]

6.8.13 Locator facility

Organization of this subsection
(1) Overview of the locator facility
(2) Application criteria
(3) Advantages
(4) How to use

(1) Overview of the locator facility

If a retrieved BLOB or BINARY data item is received by a client UAP as a BLOB-type or BINARY-type embedded variable, a memory area sufficient to store the received data must be allocated on the client side. This may strain the memory resources on the client side when large amounts of data are being retrieved. A large amount of data must also be transferred from the server to the client. However, if only a portion of the data is needed, or if the received data will be specified without change in another SQL statement and then returned to the server, transferring the data to the client is a waste of resources.

The locator facility is designed to overcome this problem. A locator is a four-byte value that identifies data on the server. By specifying a locator embedded variable in a single-row SELECT statement or in the INTO clause of the FETCH statement, you can retrieve in the search results only the locator value that identifies the data rather than the entire data item. You can also specify the locator embedded variable that identifies such data in another SQL statement, which enables you to process the data identified by the locator.

Figure 6-20 provides an overview of the locator facility.

Figure 6-20 Overview of the locator facility

[Figure]

Explanation

Locator facility is not used:
  1. The BLOB data retrieved from the database is transferred from the server to the client.
  2. The BLOB data is transferred from the client to the server, and then stored in the database.

Locator facility is used:
  1. The server creates a locator data item that identifies the data retrieved from the database.
  2. The locator data item is transferred from the server to the client.
  3. The locator data item is transferred from the client to the server.
  4. The BLOB data on the server that was identified by the locator data item is stored in the database.

(2) Application criteria

The locator facility is useful whenever you retrieve BLOB or BINARY data.

By using the locator facility, the client need only allocate enough memory to store the size of the actual data being used. The amount of data transferred between the server and the client is also reduced because a locator is used.

(3) Advantages

Using the locator facility reduces the amount of memory required on the client side. It also reduces the amount of data transferred between the server and the client.

(4) How to use

To receive the value of a locator, replace in the SQL statement the embedded variable that receives the BLOB-type or BINARY-type data with the applicable locator-type embedded variable. To process the data allocated in the locator, specify the applicable locator-type embedded variable in the SQL statement, rather than specifying a BLOB-type or BINARY-type embedded variable.

For details about the locator facility, see the HiRDB Version 8 UAP Development Guide.