Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SQLite or CSV?
Qt 6.11 is out! See what's new in the release blog

SQLite or CSV?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 1.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • timmie124T Offline
    timmie124T Offline
    timmie124
    wrote on last edited by
    #1

    I'm currently working on a program reads a live chat log and alerts you when certain things are said in the chat log. I was originally planing on using a CSV file to refrence the chat log but the file was much larger than what I was expecting, 84MB, 503051 rows 15 columns. This is a read only program nothing will ever be written to the csv file.

    What I was wondering what would be the efficient way to use this file? just leave it as a CSV or embed SQLite into the program.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Well besides that CSV text file demands careful handling of "", etc
      its also important to consider if you want to filter/sort/ look around in the data.
      In that case SQL db provides many benefits.
      Also a powercut might corrupt the text file
      where as transactions and sqlites db format
      makes that more unlikely to happen.

      So it also depends on what you consider + or minuses and the general use case.

      1 Reply Last reply
      3
      • BuckwheatB Offline
        BuckwheatB Offline
        Buckwheat
        wrote on last edited by
        #3

        @mrjj is correct. CSV, being a flat file, has lots of CONs when trying to manipulate the data and is really only good for simple data transfer. A good SQLite3 database gives all kinds of benefits. Sorting, filtering, querying parameters, compact, etc.

        SQLite3 is used by Android phones for their messaging. It is used by Mozilla for all kinds of settings and attributes. It is public, robust, and well supported. Its an all around win! The best part about using SQL is that if you ever need to go BIG... change the driver and the code still works as expected.

        As a note, I use it in embedded applications for alert management, sensor plug-n-play, and settings for global and user centric and it performed great.

        Dave Fileccia

        1 Reply Last reply
        2
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          Just to add, for logs xml is a popular option that is not affected by the drawbacks of csv. A lot of programs use this format for logs

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved