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. [SOLVED] Inter-Process Communication
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Inter-Process Communication

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 3.3k 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.
  • D Offline
    D Offline
    dvillalobos
    wrote on last edited by
    #1

    Hi all,

    I want to make an app to migrate MySQL databases, I need to use QProcess since I need mysqldump and mysql to do the trick, but I need to comunicate them.

    My question is, will QSharedMemory do the trick?

    Best
    Regards.

    Regards

    David

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

      Hi,

      What do you mean by "I need to communicate them" ?

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

        Hi SGaist, thanks for reply,

        I mean that que QProcess that runs mysqldump pass its output to the QProcess thar runs mysql, so I can migrate the database. Like in this Linux example:

        mysqldump -u USER -p DATABASE | mysql -h DEST_HOST -u root -p123 DEST_DATABASE

        Regards.

        Regards

        David

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          you need to do the piping by yourself. QProcess provides the necessary methods for reading stdout and setting stdin.
          This enables you to chain the commands like you want to do.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • P Offline
            P Offline
            prady_80
            wrote on last edited by
            #5

            Normally shared memory with a timer polling for completion status of the mysqldump process should work ... But if are on Unix or Linux (which is what I assume looking at the database) and you need Signals and slots support you can use the Qt Dbus module.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dvillalobos
              wrote on last edited by
              #6

              Hi raven-worx, thanks for reply.

              I'll try setStandardOutputProcess and tell you how it goes.

              Regards.

              Regards

              David

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dvillalobos
                wrote on last edited by
                #7

                Here is the code

                @
                QProcess process1;
                QProcess process2;

                process1.setStandardOutputProcess(&process2);

                QStringList argumentsProcess1;
                argumentsProcess1 << "--user=USER";
                argumentsProcess1 << "--host=HOST";
                argumentsProcess1 << "--password=PASS";
                argumentsProcess1 << "--port=3306";
                argumentsProcess1 << "mysql";

                QStringList argumentsProcess2;
                argumentsProcess2 << "--user=USER";
                argumentsProcess2 << "--host=HOST_2";
                argumentsProcess2 << "--password=PASS";
                argumentsProcess2 << "--port=3306";
                argumentsProcess2 << "--database=mysql";

                process1.start("mysqldump", argumentsProcess1);
                process2.start("mysql", argumentsProcess2);
                process1.waitForFinished();
                process2.waitForFinished();
                @

                Regards

                David

                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