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
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.
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...
=================================================================
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.
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.