Icon View Incident Report

Serious Serious
Reported By: Ed Andes
Reported On: 4/24/2012
For: Version 2.08 Build 1
# 3584 Parameters for Derived Tables Created in Wrong Order

With parameterized queries, my understanding was that each of the placeholder question marks (?) used in a parameterized query required a corresponding variable to be used in the same position/order as the ?’s…that it was a serial substitution if you will. So far with the queries I have been doing that has been the case. I’m now writing a proc using a derived table in a JOIN, where the derived table sql has a parameter in it to substitute.

I would expect to execute this statement using “EXECUTE stmtAliases USING Lsn, Id, Wsn;” where I have defined values for Id and Wsn coming into the proc and Lsn would contain the result. However when stepping through the debugger in EDB Manager, executing the query changes the value of Id to the value I would have expected for Lsn, and returns no rows. I then switched the order in the execute statement to “EXECUTE stmtAliases USING Id, Lsn, Wsn;”…switching the position of Id and Lsn…and it worked.

PREPARE stmtAliases FROM 'SELECT "ldt"."Lsn" INTO ?
                        FROM "LogData" AS "ldt"
                        INNER JOIN (SELECT "Alias", "Seq"
                                    FROM "AliasLogCurve"
                                 WHERE "Id" = ?) AS "alc"
                           ON "ldt"."Lsn" = "alc"."Alias"
                        WHERE "ldt"."Wsn" = ?
                        ORDER BY "alc"."Seq"
                        RANGE 1 TO 1';



Comments Comments
The parameters in the FROM clause were being populated after the parameters in the WHERE clause, thus violating the left-to-right ordering of the parameter markers.


Resolution Resolution
Fixed Problem on 4/24/2012 in version 2.09 build 1


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image