c++ database?

Discussion in 'Mac Programming' started by lorductape, Nov 5, 2006.

  1. lorductape macrumors 6502

    lorductape

    Joined:
    Jun 23, 2006
    Location:
    t3h usa
    #1
    can anyone give me some sample code to create a c++ database?
     
  2. SMM macrumors 65816

    SMM

    Joined:
    Sep 22, 2006
    Location:
    Tiger Mountain - WA State
    #2
    MySQL is all open source I believe. Is there a reason you want to create a database instead of using an existing one?
     
  3. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #3
    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.
     
  4. SMM macrumors 65816

    SMM

    Joined:
    Sep 22, 2006
    Location:
    Tiger Mountain - WA State
    #4
    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.

    http://www.classicsoftware.com/prod04.htm

    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)
    Table Name
    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?
     
  5. lorductape thread starter macrumors 6502

    lorductape

    Joined:
    Jun 23, 2006
    Location:
    t3h usa
    #5
    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. ;)
     
  6. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #6
    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.
     
  7. seanf macrumors 6502

    Joined:
    Aug 8, 2006
    Location:
    UK
    #7
    See http://www.sqlite.org/ for details.

    Sean :)
     

Share This Page