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

QSqlRecord incorrectly returns Type::String on MySQL POINT column

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important 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)

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes