Data Tables in C++

I am facing a desperate situation where i need to keep data of all the records of a table. e.g ( select * from CUSTOMERS ) is there a Data Table kind of a structure either developed by a third party or a STL structure that you'll guys know of.

this is kind of similar to DataTables in .Net or Java. i should be able to fill them and access the rows and the columns by indexes and column names

closed account (S6k9GNh0)
Sounds kinda similar to STL maps...Doesn't sound like an exact fit though :/
I don't know of anything like that, but there are other alternatives. SQLite can be used as an in-memory DB. So you can select from one database and then insert them into an in-memory SQLite instance. SQLite has C++ bindings. Or you could use OTL (http://otl.sourceforge.net/otl4_sqlite_examples.htm) for a iostreams-like interface to your data.
you can design something like that using a combination of maps and vectors.
i have done it in past.

closed account (S6k9GNh0)
I suppose I wasn't too far off then! For a second I sounded like an idiot! (No comment please :P)
Another way to do this is to represent the entity type occurrences (table rows) by instances of a class (objects).

The column names of tables become attribute names of objects. Entity type keys (table keys) become identifying attributes of the objects. Association variables correspond to foreign key relationships, and so on.

Here is a table that I drew up showing how concepts in object theory and relational theory correspond...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
=================================================================
OO Application                  Relational database
=================================================================
Initial structural model        Conceptual data model
Class                           Entity type
-----------------------------------------------------------------
Object                          Entity type occurrence
-----------------------------------------------------------------
Association                     Relationship
-----------------------------------------------------------------
Link                            Relationship occurrence
-----------------------------------------------------------------
Multiplicity                    Degree
-----------------------------------------------------------------
Multiplicity                    Participation conditions
-----------------------------------------------------------------
Attribute                       Attribute

Attribute instance              Mandatory single-valued property
variable
-----------------------------------------------------------------
Association variable            Referenced key (that is,
                                referenced by foreign key values)

Association instance            Optional single-valued property
variable - single value

Association instance            Optional or mandatory
variable - collection           multi-valued property
-----------------------------------------------------------------
Invariants                      Additional constraints
-----------------------------------------------------------------
Dictionary key                  Single-column table row key
-----------------------------------------------------------------
Multidimensional                Multi-column table row key
dictionary key
=================================================================

The objects of application processes on multiple clients can be initialised from the corresponding tables of a single database on a remote host, or locally from a copy of a database or from local files.

Dave
my problem is even more complicated than what you think. i should be able to query any database table and represent them in memory for future access.
its not just one table. the representation that i am thinking of. it should ideally host data from any table in a tabular format in the memory.

Then use several classes, each with the required number of instances.

Dave
Topic archived. No new replies allowed.