OTL 4.0, OTL stream read iterator

OTL stream read iterator

This template class extends the OTL stream interface with more JDBC-like, conventional getter functions. This template class doesn't support Unicode yet. This template class can be used with the otl_stream class as well as with otl_refcur_stream class (Oracle 8 and higher).
template<typename OTLStream, 
typename OTLException,
typename OTLLobStream>
class otl_stream_read_iterator{
public:
Function
Description
otl_stream_read_iterator();
Default constructor
~otl_stream_read_iterator();
Destructor
otl_stream_read_iterator(OTLStream& s);
general-purpose constructor, attaches to an otl_stream, or an otl_refcur_stream.
void attach(OTLStream& s);
Attaches to an otl_stream, or an otl_refcur_stream.
void reattach();
Reattaches to the same stream. It's recommended to call this function when the stream  read iterator is used with an otl_refcur_stream, and when the otl_refcur_stream gets closed and reopened with the same reference cursor. See examples for more detail.
void detach();
Detaches from the otl_stream/otl_refcur_stream.
bool next_row(); 
Reads the next row, returns true if the row was successfully fetched false on the end-of-fetch-sequence.
const otl_var_desc* describe
(int& var_desc_len);
Describes the output structure of the attached otl_stream. var_desc_len is the total number of elements in the output structure of the attached otl_stream. The same information can be obtained via otl_stream::describe_out_vars(), which this object is attached to.
void get(const int pos, char& c);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a signed one-byte character.
void get(const int pos, unsigned char& c);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads an unsigned one-byte character.
void get(const int pos, char* s);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a string of signed on-byte characters.
void get(const int pos, unsigned char* s);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a string of unsigned one-byte characters.
void get(const int pos, int& n);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a signed 32-byte integer.
void get(const int pos, unsigned int& n);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads an unsigned 32-bit integer.
void get(const int pos, short int& n);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a signed 16-bit (short) integer.
void get(const int pos, long int& n);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a signed long integer (32, or 64-bit, depending on whether it's a 32-bit, LLP64 or LP64 platform).
void get(const int pos, float& n);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a 4-byte floating point numeric value.
void get(const int pos, double& n);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads an 8-byte floating point numeric value.
void get(const int pos, OTL_BIGINT& n);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Reads a signed 64-bit integer.
void get(const int pos, OTL_STRING_CONTAINER& s); 
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Gets an std::string if #define OTL_STL is enabled. Gets an std::string if #define OTL_STLPORT is enabled. Gets an ACE_TString if #define OTL_ACE is enabled. VARCHAR, CHAR, LONG, TEXT, VARCHAR(MAX), and CLOB values can be read by this function.

Gets a USER_DEFINED_STRING_CLASS instance if #define OTL_USER_DEFINED_STRING_CLASS_ON is enabled.
void get(const int pos, otl_long_string& s);

JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.


Gets an otl_long_string.

void get(const int pos, otl_long_string*& s); 
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Gets a pointer to otl_long_string. This is more optimal than the previous function, especially in the case of a large string.
void get(const int pos, otl_lob_stream*& s);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.

Gets a pointer to otl_lob_stream. This function can be used if the otl_stream that the read iterator is attached to is in the LOB stream mode.
void get(const int pos, otl_datetime& s);
JDBC-like getter function.  pos is 1,2,... as in JDBC getXXX functions.


Gets an otl_datetime.

bool is_null(const int pos); 
Returns true if the value at position "pos" is NULL. Otherwise, returns false.
void get(const char* var_name, char& c);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a signed character.
void get(const char* var_name, unsigned char& c);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads an unsigned character.
void get(const char* var_name, char* s);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a string of signed one-byte characters.
void get(const char* var_name, unsigned char* s);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a string of unsigned characters.
void get(const char* var_name, int& n);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a signed 32-bit integer.
void get(const char* var_name, unsigned int& n);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads an unsigned 32-bit integer.
void get(const char* var_name, short int& n);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a signed 16-bit (short) integer.
void get(const char* var_name, long int& n);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a signed long integer (32, or 64-bit, depending on whether it's a 32-bit, LLP64 or LP64 platform).
void get(const char* var_name, float& n);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a 4-byte floating point numeric value.

void get(const char* var_name, double& n);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads an 8-byte floating point numeric value.
void get(const char* var_name, OTL_BIGINT& n);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a signed 64-bit integer.
void get(const char* var_name, OTL_STRING_CONTAINER& s); 
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads an std::string if #define OTL_STL is enabled. VARCHAR, CHAR, LONG, TEXT, and CLOB values can be read by this function.
void get(const char* var_name, otl_long_string& s);
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads an otl_long_string
void get(const char* var_name, otl_long_string*& s); 
Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a pointer to otl_long_string. This is more optimal than the previous function, especially in the case of a large string.
void get(const char* var_name, otl_lob_stream*& s); 

Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.

Reads a pointer to otl_lob_stream. This function can be used if the otl_stream that the read iterator is attached to is in the LOB stream mode.

void get(const char* var_name, otl_datetime& s);

Only when #define OTL_STL or OTL_STLPORT or OTL_ACE is enabled.

JDBC-like getter (by name) function. var_name is a variable / column name from the list that can be retrieved by a call to the describe() function of this class. All variable names are case insensitive.


Reads an otl_datetime

bool is_null(const char* var_name); 
Returns true if the value of the "var_name" variable is NULL. Otherwise, returns false.
}; // end of otl_stream_read_iterator

Prev NextContentsGo Home

Copyright 1996-2017, Sergei Kuchin, email: skuchin@gmail.com, skuchin@gmail.com .

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. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.