relational database

Z

zfareed

I would like to create a relational database using only C++. What
would be more appropriate, using arrays, linked lists or some sort of
templates and structs? Any advice?
 
J

James Kanze

I would like to create a relational database using only C++. What
would be more appropriate, using arrays, linked lists or some sort of
templates and structs? Any advice?

In memory, or on disk. In memory, the basic data structure
would be a struct for each table, with the table being an
std::vector of the struct; in addition, you might want to use
std::set of indexes into the vector for keyed accesses.

On disk, you'd have to design the structures yourself, but a
binary file with fixed length records can be used to simulate
the vector, with btrees for the std::sets.
 
M

Mike Wahler

I would like to create a relational database using only C++. What
would be more appropriate, using arrays,

Don't use arrays. Standard library containers are safer,
easier to use, and have built-in operations.
linked lists

A linked list (possibly in addition to other structure type)
is one of many possibilities.
or some sort of
templates

Templates are for building generic classes and functions.
They might or might not help, depending upon your needs.
and structs?

It's highly likely you'd use structs to define database records.
(Note that in C++, a class and a struct are the same thing, only
with minor semantic difference).
Any advice?

You need to determine specifically what your database needs to
do. Only then could you make intelligent choices about its
implementation.

Finally, yours is not a question about the C++ language; you'd
probably get the best advice by asking this in a newsgroup about
databases.


-Mike
 
D

Default User

2b|!2b==? said:


Probably as a training project. It would be a way to increase one's
knowledge of both relational database implementation and C++
programming.




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,301
Messages
2,571,549
Members
48,295
Latest member
JayKillian
Top