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

UUID data type support for mariadb / MySQL

    XMLWordPrintable

Details

    Description

      Since the version 10.7 mariadb has a built-in UUID data type, but the current MySQL driver in Qt handles a UUID field as a QByteArray. 

       

      Assuming a record is inserted with this SQL command :

       

        CREATE TABLE `course` (
          `id` uuid NOT NULL DEFAULT uuid(),
          `name` varchar(128) NOT NULL,
          `description` varchar(128) DEFAULT NULL,
          PRIMARY KEY (`id`),
          UNIQUE KEY `uk-course-name` (`name`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
      
        INSERT INTO `course` VALUES
        ('b3b7e0b6-786d-11ef-8ea3-d71e1201ccfc','T&E 4104','Test and Evaluation II'); 

       

      Qt SQL application reads this record and interprets it as below :

       

      QSqlRecord(3)
      0: QSqlField(id, QByteArray, tableName: course, length: 144, precision: 0, required: yes, generated: yes, typeID: 254, autoValue: false, readOnly: false)  
      1: QSqlField(name, QString, tableName: course, length: 512, precision: 0, required: yes, generated: yes, typeID: 253, autoValue: false, readOnly: false)  
      2: QSqlField(description, QString, tableName: course, length: 512, precision: 0, required: no, generated: yes, typeID: 253, autoValue: false, readOnly: false) 

       

      Since Qt Core has QUuid Class, it should be utilized here.

      https://doc.qt.io/qt-6/sql-types.html indicates that is supported for Mimer SQL. The same support is disireable for mariadb / MySQL as well.

       

       

      Attachments

        For Gerrit Dashboard: QTBUG-130389
        # Subject Branch Project Status CR V

        Activity

          People

            chehrlic Christian Ehrlicher
            hitoshiito Hitoshi Ito
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change