Board index » delphi » Multiple param entries in SQL statement causes AV

Multiple param entries in SQL statement causes AV

Hello, developers of TIBCustomDataSet (and relative)!

Somehow, when SQL statement contains more than one entry of an parameter,
using this parameter's value like
DataSet.QSelect.Params.ByName( 'c_year' ).Value := xx
causes AV at procedure IBSQL.TIBXSQLVAR.SetIsNull(Value: Boolean),
because xvar.FXSQLVAR^.sqlind is nil for i>0.
(using IBXDP5EBETAUP41, IBSQL.pas, line 1259).
The same, if assigning DataSet.Params.ByName().Value.

My current workaround is assigning "processed" SQL statements with
parameters set "statically"
(like << SelectSQL.Text := Format( 'SELECT * FROM xxx WHERE l_year=%d',
 cur_year ] ) >> ),
which of course will not work fast if placed in a detail TIBDataSet.

BTW, the way DataSet.Params works is not very useful, IMHO. (As I see it is
the same as QSelect.Params? )
These parameters should be global for the whole this TIBCustomDataSet,
affecting QSelect,
QInsert, QModify and QDelete statements, because it is needed
to assign each QSelect.Params.ByName( 'par_name' ).Value,
QModify.Params......, QDelete.Params..., etc.

I wonder, if multiple parameter entries are not so often encountered by
others?

VB

 

Re:Multiple param entries in SQL statement causes AV


I also noticed this behavior just now and agree on both points  (multiple
parameters, greater visability of parameters).

If I use a parameter for a master detail relationship on select, I will
usually need the same value for inserts, updates.... Currently I assign it
in the OnNewRecord event to another field.

Quote
"Val Bostan" <r...@master.md> wrote in message

news:8fgu4i$ip18@bornews.borland.com...
Quote
> Hello, developers of TIBCustomDataSet (and relative)!

> Somehow, when SQL statement contains more than one entry of an parameter,
> using this parameter's value like
> DataSet.QSelect.Params.ByName( 'c_year' ).Value := xx
> causes AV at procedure IBSQL.TIBXSQLVAR.SetIsNull(Value: Boolean),
> because xvar.FXSQLVAR^.sqlind is nil for i>0.
> (using IBXDP5EBETAUP41, IBSQL.pas, line 1259).

> The same, if assigning DataSet.Params.ByName().Value.

> My current workaround is assigning "processed" SQL statements with
> parameters set "statically"
> (like << SelectSQL.Text := Format( 'SELECT * FROM xxx WHERE l_year=%d',
>  cur_year ] ) >> ),
> which of course will not work fast if placed in a detail TIBDataSet.

> BTW, the way DataSet.Params works is not very useful, IMHO. (As I see it
is
> the same as QSelect.Params? )
> These parameters should be global for the whole this TIBCustomDataSet,
> affecting QSelect,
> QInsert, QModify and QDelete statements, because it is needed
> to assign each QSelect.Params.ByName( 'par_name' ).Value,
> QModify.Params......, QDelete.Params..., etc.

> I wonder, if multiple parameter entries are not so often encountered by
> others?

> VB

Other Threads