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. generic sql database copy
Forum Updated to NodeBB v4.3 + New Features

generic sql database copy

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

    Hi all!

    I am about to write a generic database copy function. To get the order right, in which the tables must be copied, I need to know about references between tables, so that I copy the referenced table before the referencing table.
    How could I find out, if a table has references?

    Thanks for your time,
    Holger

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

      Hi,

      Most of the databases system have a dump method/helper application that should do the job.

      Is it something like that that you are looking for ?

      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
      • HoMaH Offline
        HoMaH Offline
        HoMa
        wrote on last edited by
        #3

        Unfortunately not. My question comes from a different direction: I write a database app with a very specific purpose. I assume, that the schema will have to change from time to time. But my assumption is, that as long as I keep the changes "compatible" - like only adding fields or changing fields from "not null" to "null allowed" it should be OK to create a database with the new schema and copy all existing data - at least for the columns, which exist in the source database.
        So this copy should be a way to keep my databse always compatible with the application.
        Sorry if this sounds complicated. I hope this is clear?

        Thx and best regards
        Holger

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

          In that case, you might want to consider using migrations a bit like Django does so you do not have to take such limitations into account.

          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
          • HoMaH Offline
            HoMaH Offline
            HoMa
            wrote on last edited by
            #5

            Not sure, what django refers to, to be honest. But I do not want the user to do anything - the conversion should just happen on the startup of my qt app.
            That's why I search for a solution in Qt. ...

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

              Sorry, the Python Django project. I referred to it as inspiration not as replacement.

              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
              • HoMaH Offline
                HoMaH Offline
                HoMa
                wrote on last edited by
                #7

                OK - I got it. I will have a look.
                But I have to admit, that this is the only piece that is missing - everything else I have done before and know how to do - so knowing about the references would really be helpful.
                On the other hand: I might just use pragmas and switch references off - with this I should be able to copy the tables in any order ...

                Anyhow - as always: thanks a lot for your support!

                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