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

Issue in a prepare statement that is "too long"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.12.2
    • SQL Support
    • None
    • Windows

    Description

      I have a problem with QODBC driver. I am connecting to a MSQLserver 2017. I have the following Native Client: ODBC Driver 17 for SQL Server

      --------------------------------------------------

      QString str1 = "SELECT * FROM Table1 WHERE FullName = :FullName";

      QString str2 = "\\\\abcidnas\\data\\Formats\\avexxxrokee_xxxxbset\\Cvvvvv_JJJJJJJJJJ\\RS2_OK7002_PK95155_DK94211_SCNB_20090909_234152_HHHHHHHHH
      LLLLLLLLLLL.tif";

      if (Query.prepare(str1))

      Query.bindValue(":FullName", str2);

      Query.exec();

      ------------------------------------------------------------------------

      we have observed that if the value for the bindvalue for the prepare statement is too long, then the prepare statement fails with 

      QODBCResult::exec: Unable to execute statement: "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The data types nvarchar(max) and ntext are incompatible in the equal to operator. [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Statement(s) could not be prepared."

      We don t use at all NTEXT in the design of our database.

      what works:

      if I use a Direct Exec and not a prepare statement it works.

      Query.exec("SELECT * FROM Table1 WHERE FullName = '\\\\abcidnas\\data\\Formats\\avexxxrokee_xxxxbset\\Cvvvvv_JJJJJJJJJJ\\RS2_OK7002_PK95155_DK94211_SCNB_20090909_234152_HHHHHHHHH
      LLLLLLLLLLL.tif'"))

      If the binding value is small then it works.

      Other things tested

      I tried several datatype for the column FullName : NVARCHAR(MAX), VARCHAR(MAX),... nothing worked.

      Maybe I am missing a configuration .... 

      Thank you, any help appreciated. This is customer issue.

       

       

       

       

       

       

       

      Attachments

        Issue Links

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

          Activity

            People

              mabrand Mark Brand
              marksheridan Mark Sheridan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes