Open SQL - Streaming and Locators
In Open SQL you can use data streams and locators to access LOBs in database tables. The corresponding objects are grouped together under the term LOB handles. Whilst a locator is always an LOB handle, in principal there can also be data streams for other resources (refer to Streaming).
For normal access to LOBs, ABAP data objects of the types
xstring are used, into which the entire LOB is transferred for read access and from which the entire LOB is taken for write access. Data streams and locators, however, work as follows:
- For read access, read streams can be linked to LOBs using the assignment of corresponding reference variables. The same applies for write access and write streams. LOB data can be partially processed using the methods of the streams. This is advantageous, since the LOBs do not have to be completely realized in the ABAP program.
- For read- and write access, locators can be linked to LOBs by assigning corresponding reference variables. Using the methods of the locators, you can access the sub-sequences of LOBs or the properties of LOBs without requiring a complete realization in the ABAP program. Furthermore, locators enable the copying of LOBs within the database without having to transport the data between the database and the application server.
The use of data streams and locators for LOBs in database tables can lead to improved performance with regards to the program runtime, by omitting unnecessary data transports. There are, however, also some disadvantages:
- The use of locators leads to higher resource consumption in the database system. Locators are not yet supported by all databases. In this case, they have to be emulated from the database interface on the application server.
- The use of data streams does not lead to increased resource consumption in the database system, but data streams are somewhat more limited in their use. In particular, data streams can not be used if internal tables are being processed in the Open SQL statements.
The following sections introduce the classes for data streams and locators as well as the interfaces they include for general LOB handles.
A maximum of 1000 LOB handles can be open in a database LUW.