Icon View Incident Report

Serious Serious
Reported By: Joseph
Reported On: 7/9/2007
For: Version 1.04 Build 4
# 2408 Second and Subsequent Executions of Parameterized Queries Causes No Rows to Be Returned

I have run into a problem trying to use "prepare" before executing parameterized query multiple times. The following code returns correct result set on first iteration but empty result sets after that. When I comment out Prepare, everything works fine.

const
  _qs = 'select * from testDetails where (Id=:id)' ;
var
  _q : TEDBQuery ;
  _arr : array of Integer ; // will be initialized with a list of existing ids
.....
begin
....
  initArray;
....
  _q := TEDBQuery.Create(nil) ;
  with _q do begin
....
           SQL.Add(_qs) ;

           Prepare ; // here my problems start

           for _i := 1 to StrToIntDef(edtStressCount.Text, 100) do begin
              _rand := Random(High(_arr)) ;
              ParamByName('id').AsInteger := _arr[_rand] ;
              Open ;
              // only the first iteration returns records. Needs checking
              log(Format('Result for testId=%u idx=%u id=%u : found %u records '+
                         '(param=%u', [_i, _rand, _arr[_rand], RecordCount, '+                                 ParamByName('Id').AsInteger])) ;
              Close ;
           end ;
...



Resolution Resolution
Fixed Problem on 7/10/2007 in version 1.04 build 5


Products Affected Products Affected
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