Thread: Storing data in table format (Without SQL)

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    13

    Question Storing data in table format (Without SQL)

    Is it possible to store data in a file in a table-like format (similar to SQL) but without SQL? I don't want my user to have to run a SQL server to run their program (that would be ridiculous), but I'm in need of a better storage method than just storing things in a text file.

    My program is a virtual study program called VFC (Virtual Flash Cards). As of now, when the user builds a list to study from I have the program store the word, then go to the next line, store the definition, then go to the next line, repeat. When the user is done entering words and definitions it prints EOF on the last line. There are many flaws to this system and I'm sure any decent programmer can see that; so what should I do? I'm looking for a system where I can have it store words and definitions just as you would in a SQL database (but without it of course). Any suggestions? Thank you!

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    What about an embedded SQL like SQLite? Best of both worlds.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    13
    Any tutorials or something I could consult for the API to do something as simple as storing a table with 2 columns?

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    If you want to just store pairs also look at something like HamsterDB (hamsterdb embedded database: main page)

    Also SQLite (as mentioned) is a good library and has lots more to offer

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    13
    How heavy are those (in size)?

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Quote Originally Posted by sudox View Post
    How heavy are those (in size)?
    Not much...how heavy do you want?

  7. #7
    Registered User
    Join Date
    Nov 2010
    Posts
    13
    Well I distribute my program via Mediafire and so I'd like to keep the size of the total program (archived and compressed in a .rar) <5MB

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    SQLite can come in 2 files - a 'C' file and a header that weighs in at about 4.5Mb

    On compiling it, well it depends on your compiler and optimizations.

    I was messing with it a while ago to see how it worked, so I just rebuilt it for release with a few added boost code for good measure and it weighed in at > 500Kb for the exe. So no...not really that heavy.

    And when you consider all the fat-arsed java libraries out there I wouldn't be too worried about your app's size

  9. #9
    Registered User
    Join Date
    Nov 2010
    Posts
    13
    Okay, I'll look into it; thanks :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. data structure design for data aggregation
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 05-20-2008, 06:43 AM
  2. Replies: 3
    Last Post: 04-18-2008, 10:06 AM
  3. HELP with storing serial port data into txt file
    By inmaterichard in forum C Programming
    Replies: 2
    Last Post: 04-02-2008, 02:20 AM
  4. Storing data in ORACLE or SQL
    By Arafat_211184 in forum C++ Programming
    Replies: 3
    Last Post: 05-03-2006, 01:14 AM
  5. C diamonds and perls :°)
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM