Hi Guys,

I'm trying to create my own DBMS. For now i want to create a simple one where i can 'create' tables, 'insert' data and do a 'select' for all values(no where condition as of now). Very basic features. This is the first design/pseudo code that i have come up with. I'll be using a .dat file to save data, one file for each table. It will have a 'headerInfo' at the top indicating the columnNames|length (i'm not checking dataType as of now. I'm thinking of using sql style query system which i will parse and confirm syntax, No UI as of now.

Please see this pseudo code and let me know what are the drawbacks/incorrect design or any possible road blocks i'll encounter if i try to extend this.

Class Object
function: create
function: loadObjectDictionary
function: updateObjectInfoFile
----------------------------------------
m_objectDictionary tableName-FileName
Class table:Object
function: create
create a new file for the table
create a 'table_header_info' which is delimited string of columns|length
open file
insert header info at top of file.
close file
insert the table_name-fileName entry in 'm_objectDictionary'
function: insert
load m_headerInfoDictionary
validate number of values and size of each column against length
if validations are fine
open the file.
add row
close file
else
error
function: select
create object of 'table' class using tablename
load the corresponding file using tablename from m_objectDictionary
read the file
close file
format and display contents
---------------------
m_headerInfoDictionary
m_numberOfColumns

class User
function: createUser
function: authenticate

i know its not very clear, probably i'll post some code when i'm done.

I like to know how compilers work. I am still in the expression evaluation bussiness, perhaps maybe a tiny compiler later on. I would not even think on rewriting C++!
Perhaps you like to know how databases work, then I should say, carry on with what you have, it looks ok to me. Another suggestion: read a book on the subject.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.