PDA

Click to See Complete Forum and Search --> : Making a Database


dclamp
Apr 22nd, 2007, 11:18 PM
how hard would it be to make your own Database? Not like a database inside of MySQL/MSSQL, but like your own db system?

RobDog888
Apr 23rd, 2007, 01:00 AM
Why re-invent the wheel? If its a matter of price then use Access as its free to distribute its databases and the MDAC runtimes.

sevenhalo
Apr 23rd, 2007, 01:13 AM
Sounds more like a challenge then anything.

In which case, a data store is a data store. You can make it as simple as a txt or dat file (or some custom extension if you want) that you read yourself. How you read it, index it and access it is all you'll be building. The "database" aspect is sickeningly easy... All the tools you use with it is where it gets fun.

penagate
Apr 23rd, 2007, 10:04 AM
A DBMS comes in several layers. At the top is the API; at the bottom, the storage engine. The fun stuff is everything in between.

I imagine you could build a simple one very easily, as sevenhalo suggests. Sounds like a good learning exercise and something I wouldn't mind doing myself if I had the time.

dclamp
Apr 23rd, 2007, 07:34 PM
Why re-invent the wheel? If its a matter of price then use Access as its free to distribute its databases and the MDAC runtimes.

it is really just to see how hard it would be and maybe i might make a really small one, just for fun ;)

RobDog888
Apr 25th, 2007, 03:10 AM
Then just use a textfile or an in file. :D

Hack
Apr 25th, 2007, 06:20 AM
Then just use a textfile or an in file. :DThat is the easy way out. :D

Go for it dclamp...see what you come up with.

dclamp
Apr 25th, 2007, 06:06 PM
I will. i will start it today... now, how should i go about making it...?

Hack
Apr 25th, 2007, 06:48 PM
I've no idea....I've never made a database.

What were some of your original ideas?

Lets talk this through.

dclamp
Apr 25th, 2007, 07:06 PM
lol i have no original ideas. lol It just came to mind like 7 secondes before posting this thread.

Rob will know what to do... where ever he is..

I think i would have to make it in VB. Probably .NET...

RobDog888
Apr 26th, 2007, 12:53 AM
I guess I have ESP now :D

Some of the older db systems used a series of text files and / or ini files. You could do that but its hard to manage and not very scaleable.

Hack
Apr 26th, 2007, 12:57 PM
Here is a very cool feature to build into your database.

Create an internal list of reserved words and don't let people use those words as field names. :sick:

Someone should suggest that to Microsoft, Oracle, MySQL, and anyone else that makes a database used in production apps.

si_the_geek
Apr 26th, 2007, 02:47 PM
Create an internal list of reserved wordsThey all have that (well, the 'popular' DBMS's do anyway).
and don't let people use those words as field names. :sick:Not surprisingly, I also wish they did that!

It's something that comes up far too often.. hence the automatic checker I wrote (link in my sig).

lol i have no original ideas. What ideas do you have? What functionality do you want?

Bear in mind that to make something with a decent amount of speed or functionality will take a long time.. and the less forward-planing you do, the worse that will be.

szlamany
Apr 26th, 2007, 02:56 PM
The first part is to create the ISAM portion.

You need a place to store data records.

You need a place to store index data.

Index data needs to be binary-searchable.

This is all very easy - we've done this on mainframes 25 years ago.

So basically - you need four functions.

Create_Database

Create_Table

Put_Record

Get_Record

Get started ;)

dclamp
Apr 26th, 2007, 05:58 PM
do i need an IDE for it?

i guess i will be storing it in a text file. Lets start with how i am going to store it first...

how should it be stored, one table per file, one database per file, one record per file...?

szlamany
Apr 26th, 2007, 07:40 PM
A table creation is basically a pile of metadata (column count, each column datatype, size, etc...)

You can store each tables-metadata in a single file or store each tables-metadata at the "head" of the single-database file.

Since we are being modern (post-1950) I would suggest that each tables-metadata is stored in a single file.

So the basic initial layout of your database file is something like this (very rudimentary - but you should get the idea)

(word) Number of Tables

... repeated for each table
(word) Number of Columns
(xxx) Name of Table

... repeated for each column
(word) size of column-definition
(word) Starting Byte
(word) Size of Column
(word) Datatype
(word) Size of column name
(xxx) Column nameAll these "blocks" of memory/data are repeated for each column and for each table that is defined.

The Create_Database and Create_Table functions create/initialize/modify this part of the file.

This would be the first part to accomplish.

dclamp
Apr 26th, 2007, 07:48 PM
ok. now what language should i write it in? I was told that i should do it in C, but i dont know a lick of C. would VB.NET be ok for it?

szlamany
Apr 26th, 2007, 07:52 PM
The two functions we are talking about - Create_Database and Create_Table could be written in fortran or cobol for all it matters - just write them!

It only matters what language you develop the "execution" functions in - and you are miles away from that ;)


btw - our EXECUTION functions on the mainframe were written in VAX-11 BASIC first and them migrated to assembler/machine code...

RobDog888
Apr 26th, 2007, 07:52 PM
I wouldnt think it would make any real difference between VB 6 or .NET but if you write it in C++ your in for a hughe headache lol.

dclamp
Apr 26th, 2007, 08:24 PM
i think this is going to be more then i am in for...

szlamany
Apr 27th, 2007, 05:53 AM
i think this is going to be more then i am in for...You break easy :D

dclamp
Apr 27th, 2007, 06:32 PM
lol yeah!

RobDog888
Apr 28th, 2007, 04:01 AM
Then if you have given up you might as well mark your thread as Resolved from the Thread Tools menu so other members will know its solved. :D

dclamp
Apr 28th, 2007, 12:17 PM
well maybe some one will come along and make it for me... lol ok i will do that.