The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> Software Design
|
Simple Database
Discuss Simple Database in the Software Design forum on Dev Shed. Simple Database Software design forum discussing design principles and non-language specific algorithms. Get help with logic, algebraic, or relational concepts.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 7th, 2002, 02:12 PM
|
|
Junior Member
|
|
Join Date: Feb 2002
Posts: 3

Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Simple Database
Hello,
I was just wondering what the best way to make a simple database for a light weight cataloging program let's say. So, probably, the most enteries would be 50 000 (big number to be safe).
So, for each table, would there be 3+ files? one for the actual data, one for the table structure, and one for each collumn index. So, would we have to load the whole data file and index files in memory before accessing the data? Ok, so let's say the table has 2 collumns one is a byte number (for indexing), and the other is 2 chars. So, in the datafile, we would just append bits.. padding each value with 0s in the front. Also, we could have a bit saying if the line were defined (in case we delete it). ex:
1 00000001 00001000 00000010
1 00000010 00000010 00010010
0 00000000 00000000 00000000
1 00000011 00001010 11001110
etc... but the bits would just be stuck one after the other... And then when a line is deleted, just change the first bit to 0.
Now, the index files, would be one file per index, and would just be mini version, having whatever column is indexed in order, and information to reach the appropriate row in the data file.
Now, what the flaws I came up with this system, is that I couldn't think of an easy way to deal with the index when appending / deleting rows. Because with the datafile, just append rows at the end, but with the index files, you have somehow put them in order, so you would have to shift all the bits after whatever row is being inserted down, and when deleting, shift all the bits up.
Also, I don't know if it's possible to get all the bits in memory linearly.
Bassically, I have no idea how real databases work, and this is just something that I came up with just by thinking of the problem. I'm considering writing an application where I would need to use this, that's why I thought of it.
Carl
|

February 7th, 2002, 04:06 PM
|
|
Contributing User
|
|
Join Date: Jul 2001
Location: Oslo
Posts: 1,516

Time spent in forums: < 1 sec
Reputation Power: 13
|
|
Well I've just started a course in database theory, so in a couple of months I can tell you  Anyway, I would suggest a book on the subject as the techniques for this kind of thing are pretty standard, unfortunately I can't recommend the book we're using in my course, simply because I haven't finished it yet... ("Database systems, the complete book" by Garcia-Molina, Ullman and Widom, in case you wondered).
__________________
--
Regards
André Nęss
Puritanism: The haunting fear that someone, somewhere may be having fun
|

February 11th, 2002, 09:31 PM
|
|
small, green, and connected
|
|
Join Date: Dec 2001
Location: FL, SC
Posts: 63

Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
As interesting as it would be to implement a database oneself, if you really do end up having to make such a catalog, I would strongly (oh, so strongly) recommend using something simple, fast, free, and already working lik MySQL or PostreSQL.
-wg <><
|

February 12th, 2002, 12:14 AM
|
|
Junior Member
|
|
Join Date: Feb 2002
Posts: 3

Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Well, if I do that, I would have to include MySQL with the program.
And right now, when I make programs, it's more for me to learn  I'm a college student right now, and I like learning (well, I like learning what I want to learn)
-cARL
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|