Results 1 to 6 of 6

Thread: How should I store data? Database? Text files? Something else entirely?

  1. #1
    Join Date
    Jul 2007
    Posts
    23
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Windows

    Question How should I store data? Database? Text files? Something else entirely?

    Hi all,

    Strange question I guess. I'm going to be storing lots of paths to lots of files with some info about the file type, and I want this data to be stored locally. Should I do this in a database, XML maybe, or is there some other storage medium I'm missing? If I should use a database, with what should I create it?

    Example:
    File1 Path: "C:\..."
    File1 Type "material"
    File1 SetID "2"

    Repeat for File2, etc.

    I know it's silly, but I've never had to store more than a bit of data, and in the past I just wrote it to a text file and parsed it back in later. It would seem I've reached the end of that solution's utility.

    Thank you for your time,
    Backslash

  2. #2
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How should I store data? Database? Text files? Something else entirely?

    How many filenames are you planning to store? Because your textfile way seems ok to me, unless you're talking about a massive amount of data.

    Of course, you could switch to an XML format, to make it more portable. I do like XML. But to be fair, the file would take even more space because of all the markup.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  3. The following user says thank you to Michiel for this useful post:

    Backslash (8th April 2008)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How should I store data? Database? Text files? Something else entirely?

    Is the problem in size of that file or access time?

  5. #4
    Join Date
    Jul 2007
    Posts
    23
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: How should I store data? Database? Text files? Something else entirely?

    I'm just looking for a solution that will be easy enough to search through. Like if I want to find all the files that belong to set 2. I could just do it line by line in text I guess. Just wondering if there's a better way.

    In that same direction, how do the big programs do it? (When they have to store a bunch of preferences for instance, or references to a large number of files.)

    Thanks for the quick replies,
    Backslash

  6. #5
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How should I store data? Database? Text files? Something else entirely?

    This sort of thing is generally handled through text files. You should just stick with that. XML is a nice way to do it.

    In theory it depends on what you mean by "a large number", but I don't think you are likely to cross that boundary.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  7. #6
    Join Date
    Jul 2007
    Posts
    23
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up Re: How should I store data? Database? Text files? Something else entirely?

    Sounds good. I really appreciate the quick answers.

    Much thanks,
    Backslash

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Handling mac text format files - support?
    By bnilsson in forum Qt Programming
    Replies: 0
    Last Post: 29th March 2008, 12:10
  3. how to save sequences of text files and sound files
    By nagpalma in forum Qt Programming
    Replies: 8
    Last Post: 3rd July 2007, 00:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.