Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 7th, 2002, 02:12 PM
majglow majglow is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 3 majglow User rank is Private First Class (20 - 50 Reputation Level)majglow User rank is Private First Class (20 - 50 Reputation Level) 
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
Comments on this post
JimmyGosling agrees!

Reply With Quote
  #2  
Old February 7th, 2002, 04:06 PM
andnaess andnaess is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2001
Location: Oslo
Posts: 1,516 andnaess User rank is Private First Class (20 - 50 Reputation Level)andnaess User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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).
Comments on this post
JimmyGosling agrees!
__________________
--
Regards
André Nęss

Puritanism: The haunting fear that someone, somewhere may be having fun

Reply With Quote
  #3  
Old February 11th, 2002, 09:31 PM
webgremlin webgremlin is offline
small, green, and connected
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: FL, SC
Posts: 63 webgremlin User rank is Private First Class (20 - 50 Reputation Level)webgremlin User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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 <><
Comments on this post
JimmyGosling agrees!

Reply With Quote
  #4  
Old February 12th, 2002, 12:14 AM
majglow majglow is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 3 majglow User rank is Private First Class (20 - 50 Reputation Level)majglow User rank is Private First Class (20 - 50 Reputation Level) 
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
Comments on this post
JimmyGosling agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Simple Database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT