Separate names with a comma.
Discussion in 'Mac Programming' started by lorductape, Nov 5, 2006.
can anyone give me some sample code to create a c++ database?
MySQL is all open source I believe. Is there a reason you want to create a database instead of using an existing one?
I work with PL/SQL at work and C++ at school... I have NEVER heard of a C++ Database. Do you mean the STL (Standard Template Library)? A little more info would be appreciated.
Here is one I know of. That is unless I am missing the boat on what you are asking for (would not be the first time found guilty of that). This is not the database I would choose to build an MRP system with, although they exist.
If you are wanting to create a database engine, from scratch, in C++, salute. I can tell you the major players, but not knowing the level of complexity you require, this is going to be a little vague.
You will need at least two files, but usually three. One will store your schema, next stores the data and the optional third stores the indexes. The files will have something like this:
Schema (minimum entries)
List of Columns (attributes), data types, etc
First Data Row ID (very important)
Data Table (minimum entries)
Previous Row Pointer (long integer or single) - default 0 for 1st row
Current Row Pointer (long integer or single) - cannot be 0 or null
Next Row Pointer (long integer or single) - can be 0 (better) or null for EOF
Data in some delimited format
There are several indexing algorithms. I do not recall them off the top of my head.
Before I proceed any farther, is this the type of information you were seeking?
I really have no idea... all i want to write is a program that can store and retrive data (while outside of the running of the program, keep the info hidden in a file.)
like I said (or maybe I didnt, I don't know) I'm new to c++, having only ever done TI-83+ before.
Well, I had a project due a while back, and it was a DVD library database. All you need to do is write the data you want to an outfile. Not hard to do, but a database in C++ is extremely hard to do and maintain. Using a file with delimitors (like semicolons) are a lot easier to use and maintain because you know what's on each line of text.
Mind you this kind of program making is hard to do. It too me and my group about 4 hours to do it, and we went through multiple ideas! Linked-lists, queues, stacks... You name it we probably tried it. Just message me or reply to this topic if you want me to post the source code we have. Mind you, this is our code, and I do not want random people stealing it from us.
See http://www.sqlite.org/ for details.