#1 2014-05-23 02:41:28

畅雨
Member
Registered: 2013-10-24
Posts: 29

TQuery:Parameter '' not bound for '' ,has bug?

I  test like this:

 Q := TQuery.Create(aSQLDBConnection);
 try
      Q.SQL.Clear; // optional
      Q.SQL.Add('select * from TABLE');
      Q.SQL.Add('  WHERE ID_DETAIL=:detail;');
      Q.ParamByName('detail').AsString := '123420020100000430015';
      Q.Open;
      Q.First;    // optional
      while not Q.Eof do begin
          assert(Q.FieldByName('id_detail').AsString='123420020100000430015');
         Q.Next;
       end;
       Q.Close;   
   finally
       Q.Free;
 end;

----------------
raise error:Parameter 'detail' not bound for 'detail';

In SynDB.pas line  3397

 i := fParam.FindHashed(tmp);
    if i<0 then
      raise ESQLQueryException.CreateFmt('Parameter "%s" not bound for "%s"',[tmp,req]);

This statement  has bug?

Offline

#2 2014-05-23 06:52:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: TQuery:Parameter '' not bound for '' ,has bug?

I've just added a similar regression test.
See http://synopse.info/fossil/info/3c704e4709

No problem to run such a query, with a prepared parameter.

Are you sure you are using the latest version of the source code?
I mean unstable 1.18 ?

Why DB connection are you using?

Offline

#3 2014-05-23 15:06:40

dperolfi
Member
Registered: 2014-05-23
Posts: 2

Re: TQuery:Parameter '' not bound for '' ,has bug?

I've just installed the latest version of mORMot (1.18) and I'm running TestSQL3 program.
When the program performs test about external database (point 2.8) raises the error Parameter 'JOD' not bound for "select * from People where YearOfDeath=:YOD;"
The only way I have to complete the test program without errors, is substitute parameter YOD with the constant value 1872 in the where clause.
I'm working with Delphi XE3 - Windows Vista.
What can I do to solve the problem?

Thank you in advance
Davide

Offline

#4 2014-05-23 17:43:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: TQuery:Parameter '' not bound for '' ,has bug?

I just tried with XE4 and was able to reproduce the issue.
No issue with Delphi 7.

It should be fixed by http://synopse.info/fossil/info/08119ca38c

Sorry for the regression.
No, with the newly introduced test, it should not occur any more.
Thanks for your feedback!

Offline

#5 2014-05-24 05:33:02

畅雨
Member
Registered: 2013-10-24
Posts: 29

Re: TQuery:Parameter '' not bound for '' ,has bug?

thanks !

Offline

#6 2014-05-24 07:59:04

dperolfi
Member
Registered: 2014-05-23
Posts: 2

Re: TQuery:Parameter '' not bound for '' ,has bug?

Great!
Thanks

Offline

Board footer

Powered by FluxBB