Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73956

Can't use singleton design for Data Access Layer?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.12.1
    • SQL Support
    • None
    • Yocto, Boot2Qt, RPi3, C++
    • Linux/X11

    Description

      I have a singleton design for Data Access Layer (DAL) for accessing MySQL on local system. There are multiple threads using DAL to read and write data into underlying MySQL database. The target platform is RPi3 and build is done on a Yocto machine (building Boot2qt). Before upgrading to 5.12.1 we were running on 5.9 without any issues. After upgrading to 5.12.1 the program had hiccups and we received following messages in debug window:

      QSqlDatabasePrivate::database: requested database does not belong to the calling thread.

      By design of DAL, there will be only one instance of DAL that will result in single instance of QSqlDatabase object. We receive above mentioned error(s) while a worker thread is trying to access database through DAL.

      Why worker thread is not able to use DAL on 5.12.1 while it was working on 5.9?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mabrand Mark Brand
            ag_sfa ag_sfa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes