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

QSqlRecord incorrectly returns Type::String on MySQL POINT column

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.0 Beta2
    • 5.11.2
    • SQL Support
    • None
    • Windows 10, MySQL 5.7.24 x64.
    • Windows
    • f5213ab799be73ef7e0c5fee9828d4fbcf238d95 (qt/qtbase/5.15)

    Description

      When querying the type of the POINT spatial datatype in MySql, QSqlRecord returns type QVariant::Type::String, but it should return QVariant::Type::ByteArray. Example:

      QString sqlCommand = "SELECT * FROM test_point_tbl;"; 
      // NOTE: table contains a single column of type POINT
      QSqlQuery sqlQuery(db); 
      if (sqlQuery.exec(sqlCommand)) { 
        sqlQuery.record().field(0).type(); 
        // ^^^ incorrect type (QVariant::Type::String) returned
      }

      This type certainly can't be interpreted as a string. From what I can see, a POINT is stored (and specified) as a WKB (well-known binary) GIS type in MySQL. When Qt supports GIS databases, maybe it should return Point as the type, but for now, it think it should return ByteArray as the type.

       

      Full sample program attached.

      Attachments

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

        Activity

          People

            mabrand Mark Brand
            andrewkoransky Andrew Koransy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes