The Rowtype class provides a convenient container for Nullable-derived objects that are defined based on the columns in an executed SELECT statement.
Figure 2-7. class Rowtype
namespace Oracle
{
class Rowtype
{
public:
// constructors/destructor
Rowtype();
Rowtype(const Select_Stmt&);
virtual ~Rowtype();
// implementors
void add(Nullable*, const string&);
void set_null();
Nullable& operator[](const int);
Nullable& operator[](const string&);
// accessors
int ncols() const;
string colname(const int) const;
const Nullable& operator[](const int) const;
const Nullable& operator[](const string&) const;
};
ostream& operator<<(ostream&, const Rowtype&);
}The Rowtype is created with Nullable objects, the type and length of which are determined by the columns in the executed Select_Stmt object.
This method returns the name of the column at (zero-based) position column_number in the SELECT list.
const Nullable& operator[](const int column_position);
const Nullable& operator[](const string& column_name);
These methods provide access to the individual Nullable objects, either by column name or zero-based column position.
This method provides a convenient way to dump the contents of a particular row. For example, if the row contained a Varchar column named "NAME" set to "Fred," a Number column named "SCORE" set to 100 and a Varchar column named "MEMO" set to null, the output would look like this:
NAME=Fred, SCORE=100, MEMO=NULL