otl_lob_stream does not have any specific constructor by which an actual instance of otl_lob_stream can be created. Instead, the stream gets initialized by writing / reading an otl_lob_stream variable to / from the otl_stream.
Potentially, the otl_lob_stream class may raise an OTL defined exception.
class otl_lob_stream { public:
void set_len(const int alen);
otl_lob_stream& operator<<(const otl_long_string& s);
otl_lob_stream& operator>>(otl_long_string& s);
This difference is due to the differences in behavior of the
underlying database APIs. So, for writing portable [across multiple databases]
code, it is recommended to use this function carefully.
int len(void);
int eof(void);
void close(void);
}; // end of otl_lob_streamThe ODBC as well as DB2 CLI standards recommend to put LOBs at the end of INSERT/SELECT statements. For example:
INSERT INTO my_tab (f1,f2,f3_lob,f4_lob)...
SELECT f1,f2,f3_lob,f4_lob FROM my_tab...
The recommendation applies especially in the case of piece-wise data operations, that is, in the OTL LOB stream mode. At the same time, the standards say that it is up to the ODBC drivers/database APIs to either enforce or not to enforce that rule.the LOB's part of OCI8 in Oracle does not require that kind of thing, so it is really up to the developer to decide what to do. However, the general recommendation for writing portable code, that uses the LOB stream mode, would be to put LOBs at the end of the column lists in INSERT or SELECT statements.
In order to use the otl_lob_stream class for OTL/ODBC and OTL/DB2-CLI, a call to otl_stream::set_lob_stream_mode() is required.
Also, see example 56, 57, 122, 123, 124, 125, 126, 127, 128, 129.
Copyright © 1996, 2001, Sergei Kuchin, email: [email protected], [email protected] .
Permission to use, copy, modify and redistribute this document for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies.