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. Need Help with Using QDataStream
Forum Updated to NodeBB v4.3 + New Features

Need Help with Using QDataStream

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 841 Views 1 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.
  • MDCatoM Offline
    MDCatoM Offline
    MDCato
    wrote on last edited by
    #1

    I would like to be able to use QDataStream on a QSqlDatabase object but I have not had any luck getting that to work. I realize now that QSqlDatabase is not a QIODevice, but I was wondering if there was some generic way to serialize the database object? Even if someone has a hint of a way they can steer me towards?

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

      Hi and welcome to devnet,

      What is your goal with that ?

      A QSqlDatabase object represents a database connection which might not be what you are really looking to serialize.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      MDCatoM 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        What is your goal with that ?

        A QSqlDatabase object represents a database connection which might not be what you are really looking to serialize.

        MDCatoM Offline
        MDCatoM Offline
        MDCato
        wrote on last edited by
        #3

        @SGaist Thank you.
        I wanted to serialize the database itself, not the connection, so thank you for clearing that up. I know that with QSQLITE i can save the database to a file and then I can load the file into a QByteArray, and that is kinda serializing the database, but I was hoping to find a way to bypass having to save it as a file. In the worst case scenario, I can do this, but if the database contains sensitive data (like possibly passwords or the like), I would prefer to bypass leaving a copy of the db on the hard drive.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          With SQLite, the database is the file, nothing to do with how Qt uses it.

          But what is still not clear is what you want to achieve with QDataStream. Where do you want that serialisation to go to ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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