Icon View Incident Report

Serious Serious
Reported By: Michael Reisch
Reported On: 9/27/2007
For: Version 1.05 Build 2
# 2458 Parameterized UNION Queries Causing Access Violation

I get "invalid pointer operation" errormessages on some TEDBQuery components when I call the Close method. I have two Tables: Project and ProjectStructure (see below). I will combine these two tables with the following SQL command.

When I run this command, then all seems ok, I get correct result. Now I call the command the second time, I check the TEDBQuery component.Active property and close:

if qryObjectsList.Active then
qryObjectsList.Close; // sometimes I get here the invalid pointer op

qryObjectsList.SQL.Clear; // here when I try to access the SQL property I
// get an AV
qryObjectsList.SQL.Add(SQLCommand see above);
qryObjectsList.Prepare;
qryObjectsList.Open;
....

When I'm changing my SQL command to select only the first or second part (without union) all seem working fine.

select
  s.GUID_ID,
  s.GUID_Parent,
  s.Description,
  s.ImageIndex,
  s.ObjType,
  s.ProjectLeader
from ProjectStructure s
union select
  p.GUID_ID,
  p.GUID_Parent,
  p.Description,
  p.ImageIndex,
  p.ObjType,
  p.ProjectLeader
from Project p
where p.ProjectLeader = :aProjectLeader



Comments Comments and Workarounds
The workaround is to not use parameters in such a situation and to build the SQL query dynamically with the desired values.


Resolution Resolution
Fixed Problem on 9/28/2007 in version 1.06 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 VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image