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. Good way to multiple access SQL
Forum Updated to NodeBB v4.3 + New Features

Good way to multiple access SQL

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 2.0k 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.
  • cfdevC Offline
    cfdevC Offline
    cfdev
    wrote on last edited by
    #2

    In the case of SQLITE or MYSQL ?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #3

      If all users access the database only through your application you can have them notify one another of changes via QTcpSocket otherwise before submitting any change you need to perform a select and check that the value was not altered in the meantime

      "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
      0
      • M Offline
        M Offline
        mjsurette
        wrote on last edited by
        #4

        Check out QSqlDriver's notification capability. From personal experience it works well with Postgresql. I would assume that it works with MySQL, perhaps even SQLite. It is dependent on the driver implementation though.

        Mike

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #5

          check hasFeature() but I doubt SQLite has QSqlDriver::EventNotifications

          "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
          0
          • cfdevC Offline
            cfdevC Offline
            cfdev
            wrote on last edited by
            #6
            qDebug() << "driver EventNotifications: " << sdlDrv->hasFeature(QSqlDriver::EventNotifications);
            

            -> driver EventNotifications: false

            Arf, so I must make it manually ? by QTcpSocket or internally by an flag ?

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #7

              I'm afraid so

              "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
              0
              • kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #8

                Use the original data as a where clause for the update statement. This way if the data has changed in the meantime you can know, and show a message to the user, even suggest him a reload.

                Read and abide by the Qt Code of Conduct

                cfdevC 1 Reply Last reply
                3
                • kshegunovK kshegunov

                  Use the original data as a where clause for the update statement. This way if the data has changed in the meantime you can know, and show a message to the user, even suggest him a reload.

                  cfdevC Offline
                  cfdevC Offline
                  cfdev
                  wrote on last edited by
                  #9

                  @kshegunov This, complicates the SQL requests...

                  kshegunovK 1 Reply Last reply
                  0
                  • cfdevC cfdev

                    @kshegunov This, complicates the SQL requests...

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #10

                    @cfdev
                    That may be, but guarantees consistency! In any case there isn't another reliable way to do it, beside writing your own application server.

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    0
                    • cfdevC Offline
                      cfdevC Offline
                      cfdev
                      wrote on last edited by
                      #11

                      Ok, many thanks at All!

                      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