In my database project, I have Field classes and Record classes.
The Field class provides functionality for extracting the data member from a result set and and also retrieving the field name.
class Field
{
public:
virtual std::string get_field_name(void) const = 0;
virtual void load_from_result_set(const Result_Set& rs,
unsigned int column) = 0;
};
The table name is placed into the Record. The Record is a container of Field
:
class Record
{
public:
virtual std::string get_table_name(void) const = 0;
virtual void load_from_result_set(const Result_Set& rs) = 0;
private:
std::vector< boost::smart_ptr<Field> > m_field_container;
};
The Record also supports visitors and iterators.
The various types of fields are classes derived from the Field
base class.
Hope this helps.
{You can search StackOverflow for some of my questions: "C++ Thomas Matthews record field".}