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

problem with parameters in queries which have one parameter used more then once

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • 5.0.0
    • 4.5.3
    • SQL Support
    • None
    • Qt 4.5.3 with mingw on Windows XP. database is Microsoft SQL Server 2005

    Description

      if i have query which has same parameter used twice, for example:
      insert into sometable(col1,col2,col3) values (:param1,:param1,:param1)

      then it behaves incorrectly with at least microsoft sql 2000 database using odbc connection

      what happens is that while preparing statement it prepares vector with 0 values and index with one parameter, however, position of this parameter will be 3 (first two occurences will be lost)
      when i do bindValue(name,value) then value is set for this lats used position only, previous positions will remain undefined
      result is that when query is executed qt tries to process all parameters and launched query crashes on first such parameter - because of uninitialized value it tries to send value as binary and microsoft dastabase returns error because it can't convert varbin to text (or whatever else should be in this field)

      Attachments

        1. main.cpp
          2 kB
        2. qsqlresult.diff
          4 kB
        3. qsqlresult.diff
          4 kB
        For Gerrit Dashboard: QTBUG-6420
        # Subject Branch Project Status CR V

        Activity

          People

            mabrand Mark Brand
            selmi Michal Seliga
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes