Menu

Duplicate parameters in query

2014-02-23
2016-04-28
  • Marian Aldenhövel

    Hi,

    I am trying to run the Query

         SELECT
             RECID
         FROM TABLE
         WHERE ((:DX = '''') OR (DX=:DX))
             AND ((:POSTCODE='''') OR (POSTCODE=:POSTCODE))
    

    Note, that I am using each named parameter twice in the statement.

    When I prepare it in a TUIBQuery I get ParamCount=2 and two parameters
    named DX. When I trace the code I see TSQLParams.Parse passing over the
    my SQL and calling AddFieldA four times. I can see that duplicates are
    recognized and added to the end of FXSQLDA, but FParamCount is not
    incremented.

    As a temporary dumb fix I have added such an increment and I now get
    (DX, DX, POSTCODE, POSTCODE) as parameter-list. That sort of works.

    Question: Is the sort of parameter-reuse I am attempting supported by
    Firebird? By UIB? Is my fix viable?

     
  • Burov Dmitry

    Burov Dmitry - 2016-04-28

    this ghost house is abandoned long ago

    try https://github.com/hgourvest/uib/commits/master

     

Log in to post a comment.