Thread: using databases with C++

  1. #1
    Registered User Aran's Avatar
    Join Date
    Aug 2001

    using databases with C++

    Well.. i know a good deal of mySQL, and i saw that mySQL has a little API that allows you to use your mySQL db in conjunction with C++.

    Now, i'm wondering if i can use a db to store information for a game, like monster's stats and items and such. The problem is that i don't know if and how i can make the DB portable, so i can include with the game and not have to have the user set up mySQL on their comps in order to play.

    Anyone have any experience with mySQL and C++ interactivity? I'd like to know if my db idea is at all feasible or possible.

  2. #2
    Registered User
    Join Date
    Jan 2003
    Its not a good idea. First, setting up MySQL would be a pain on client computers. Second, MySQL is a seperate process/service. Third, relational databases like MySQL aren't easy to extend with. If you wanna add a new stat, you'll need a new query etc. If you want to add a unit-specific attribute, its not possible. Fourth, there is a reason why no one's done this before...

    You got a ton of other choices:
    <!-- XML: -->
    <?xml version="1.0" encoding="utf-8" ?>
    <race name="farm">
       <unit name="pony">
          <speed value="5" />
          <damage value="10" />
          <comment>A deadly creature with claw-like fangs.</comment>
    // text data file:
       name = "pony";
       speed = 5;
       damage = 10;
       comment = "A deadly creature with claw-like fangs.";
    binary lol:

  3. #3
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    oh ....

    DUH. XML is the logical solution. I can't believe i didn't think of that.

    Now.. to find a good XML parser in C++. I don't really feel like writing my own.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Concurrent Access and Databases.
    By indigo0086 in forum Tech Board
    Replies: 5
    Last Post: 05-23-2008, 11:39 AM
  2. Databases, and how they work
    By Lurker in forum A Brief History of
    Replies: 2
    Last Post: 08-14-2003, 10:22 PM
  3. C++ and Databases question
    By RyanPincher in forum C++ Programming
    Replies: 1
    Last Post: 02-04-2003, 09:00 AM
  4. Databases
    By DavidP in forum A Brief History of
    Replies: 10
    Last Post: 02-22-2002, 11:10 AM
  5. databases and C
    By Garfield in forum C Programming
    Replies: 13
    Last Post: 10-21-2001, 05:03 AM