moderated >> Creating a Database using the STL: Newbie looking for code samples

by jzapin » Thu, 13 May 2004 18:45:19 GMT

Hi,

I'm a newbie (student) looking to learn more about creating a database
using the STL.

Some of the requirements include making searching and sorting better
than O(n) complexity (in other words, they need to be fast).

Can anyone point me to some places where I can get some code samples
to help me understand it.

Thanks.

J "the newb" Z

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

moderated >> Creating a Database using the STL: Newbie looking for code samples

by cj » Sat, 15 May 2004 08:38:59 GMT


there are numerous open source databases out there already, feel free to
check out one of those for ideas and direction. postgresql had a C++ project
going on iirc...

peace,
cj




--
===============================================================================
Christopher Jon Miller Drink and dance and laugh and lie
Parallel Systems Engineer Love, the reeling midnight through
For tomorrow we shall die!
(But, alas, we never do.)
-- Dorothy Parker, "The Flaw in Paganism"
===============================================================================

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

moderated >> Creating a Database using the STL: Newbie looking for code samples

by allan_w » Sat, 15 May 2004 22:18:40 GMT


XXXX@XXXXX.COM (JZapin) wrote

The phrase "database" has more than one meaning. Normally when I hear
it I think of a persistent collection of data, organized for fast
retrieval of random elements. SQL Server, Oracle, even Microsoft Access.
This is the most usual definition of "database" but it normally isn't
handled with the STL at all.

You could also just mean a collection of data in memory; this type of
database starts empty, but populates while the program runs.

The third variation is a fusion of both methods; the database is kept
internally, but when the program exits it first writes out ALL of the
data to a file, and when the program starts up it reads ALL of the data
back in.

For both of the alternative meanings, the STL would be a fine way to
organize data in memory.


Look in to class map or multimap, depending on your data. One of these
should give you what you're after.

Note: With the STL it's important not to mix data types in the same
container. You cannot put an object of type Derived into a container
of type Base. You can create a container of pointers instead, if you
need to mix data types.


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

moderated >> Creating a Database using the STL: Newbie looking for code samples

by Dhruv Matani » Sun, 16 May 2004 03:26:59 GMT


> For both of the alternative meanings, the STL would be a fine way to
> organize data in memory.
>
>> Some of the requirements include making searching and sorting better
>> than O(n) complexity (in other words, they need to be fast).
>
> Look in to class map or multimap, depending on your data. One of these
> should give you what you're after.

What about hash_map and hash_multimap?

I know they're non-standard extensions, which may/may-not get standardized
later on, but most implementations offer them as extensions. Also their
interfaces are pretty much the same, because they are more or less all
HP/SGI derived.


--
Regards,
-Dhruv.

Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

moderated >> Creating a Database using the STL: Newbie looking for code samples

by Maxim Yegorushkin » Mon, 17 May 2004 07:32:54 GMT


You might be interested in looking at Relational Template Library - http://groups.yahoo.com/group/boost/files/tables.zip

--
Maxim Yegorushkin

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Similar Threads

1. Using "CREATE DATABASE" to create an MSDE database programmaticall

2. Looking for samples of parsing xml with linq dump to database table

Hello, I get a fairly large xml file from a vendor and I need to parse
it and dump it into a database table via passing the contents to
stored procedure parameters.  I would like to use linq. I'm rather new
to linq and I'm looking for some samples that illustrate this.  I can
find many linq examples but I'm looking for some that parse out the
xml file in a loop and calling a stored proc.

TIA

3. Looking for WinSNMP sample code

4. Looking for sample code to send email with exchange

Does anybody have sample code to send email using exchange from an MFC
application.

Thanks

Tom G


5. looking for custom control sample code

6. Looking for sample code

I need to write an app that will (magically) create a bitmap, and display it in a window
of specific width, but (possible) scrollable in height.  Is there something out there that
gets close?  TIA.


-- 
#include <standard.disclaimer>
 _
Kevin D Quitt  USA 91387-4454         96.37% of all statistics are made up

7. Delphi 7, Excel - have problem - looking for sample code - Delphi VCL Component

8. Looking for some sample codes in C#

Hi all,

I am looking for some sample codes in C#, in which, it can read a schema xsd 
file and use it to validate an xml stream or file. Ideally the sample will 
use XmlValidatingReader.

TIA,

JoeZ