I want to store the result of a SQL query into some kind of container.
Typically, a result consists of several columns, each of which has different types - depending on the query.
E.g., 'select productname, price, stock_count from...' leads to 3 result columns: char, float and int.
My Question is: How should I design a type-safe container?
IMHO a column should be represented by a std::vector. So in the example above we would have a vector<string>, a vector<float> and a vector<int>.
Do you agree so far?
Result columns are to be pooled in a container ('Result table').
And that's my real problem: how to hold pointers or references to the columns in this result table? (create the column: vector<string> *pV = new vector<string>(); ==> pV has to be stored.)
Obviously, as the number of columns may vary depending on the query, we need another vector or list of pointers.
However, the types of result columns are not known at compile time.
The time being, I can't see no other way than using void* - arrays, but I don't like that at all.
Do you have any better ideas?
(hope I could explain my problem fairly clear)
Thanks in advance