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. QMYSQL Transaction support
Forum Updated to NodeBB v4.3 + New Features

QMYSQL Transaction support

Scheduled Pinned Locked Moved General and Desktop
mysql transacti
6 Posts 3 Posters 3.1k 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.
  • C Offline
    C Offline
    Calvev
    wrote on last edited by
    #1

    Hello everyone,

    I'm starting to learn about Qt and I'm currently creating software that has database interaction.
    I'm currently using mysql via xampp on win 8.1.

    So far I've managed to perform select and insert statements without any problem.
    I want to take it a step further by introducing transaction for my insert statements.

    When I did a check on the db driver for QMYSQL, it returned 'false'.
    Question: Is this expected ? is it possible to configure QMYSQL to support transaction?

    Here is my environment configuration:

    • OS: Win 8.1
    • QT version: Qt 5.5.0 (MSVC 2013, 32 bit) with MinGw 4.9.2 compiler
    • libmysql.dll downloaded from MYSQL C connectors
    • xampp version 5.6.12
    M 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Where is libmysql.dll located in your computer ?

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

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Where is libmysql.dll located in your computer ?

        C Offline
        C Offline
        Calvev
        wrote on last edited by
        #3

        @SGaist

        Hello SGaist, thanks for helping out.
        I put my libmysql on c:/windows folder.
        I tried putting the libmysql in other folder such as mingw lib folder, or project folder, the result is still the same.

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

          Don't put anything in the windows folder. That's just plain wrong (even though numerous applications does it)

          Go to the Run part of the Project panel, update the PATH environment variable and add the path to were that dll is located

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

            Hello,

            I've moved it but it doesn't solve the problem.
            I've used a workaround on this problem by executing transaction through mysql statements.

            It goes something like this (each '-' line is a query.exec statement) :

            -start transaction
            -input statement
            (check for numrowaffected to see if statement was well executed)
            -2nd input statement
            (another numaffectedrow check)

            If both numrowcheck pass
            Commit
            Else
            Rollback

            It work fine. Is this a valid solution to go for?

            1 Reply Last reply
            0
            • C Calvev

              Hello everyone,

              I'm starting to learn about Qt and I'm currently creating software that has database interaction.
              I'm currently using mysql via xampp on win 8.1.

              So far I've managed to perform select and insert statements without any problem.
              I want to take it a step further by introducing transaction for my insert statements.

              When I did a check on the db driver for QMYSQL, it returned 'false'.
              Question: Is this expected ? is it possible to configure QMYSQL to support transaction?

              Here is my environment configuration:

              • OS: Win 8.1
              • QT version: Qt 5.5.0 (MSVC 2013, 32 bit) with MinGw 4.9.2 compiler
              • libmysql.dll downloaded from MYSQL C connectors
              • xampp version 5.6.12
              M Offline
              M Offline
              michalfapso
              wrote on last edited by
              #6

              Hi @Calvev, I had the same problem of the missing transactions feature. The problem was that I used a new version of libmysql.dll which I got from the MySQL connector package, but the server I was connecting to, was an older MySQL 5.1, so their versions did not match. When I downloaded the old 5.1 server package and extracted the libmysql.dll from there, transactions started to work :o)

              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