Subject | Parametric TIBOQuery bug |
---|---|
Author | Nando Dessena |
Post date | 2003-08-01T17:20:24Z |
Here we go again...
I have a "master" TIBOQuery component which has a DataSource attached,
and a "slave" TIBOQuery components which is attached to that
DataSource:
Master -> MasterDataSource -> Slave
Slave is an update statement, but my point is demonstrated
with select queries as well.
Let's make an example:
master is select id from mastertable
slave is update someothertable where someid = :id and foo = :foo
If I do
slave.ParamByName('foo').AsString := 'bar';
slave.ExecSQL;
the result is wrong because the ID param value is not fetched from the
master.
If I do
slave.ParamByName('id').AsString :=
master.FieldByName('id').AsString;
slave.ParamByName('foo').AsString := 'bar';
slave.ExecSQL;
of course it works.
If slave has only params named after fields in the master (ie no
custom params) then it works. In other words, adding a custom param
prevents fetching the master values.
Needless to say it works beautifully under the BDE.
As usual I have put up a simple test case that shows the problem at the click
of a button with the employee database. I am starting to turn into a
test case coder. ;-)
Ciao
--
Nando mailto:nandod@...
I have a "master" TIBOQuery component which has a DataSource attached,
and a "slave" TIBOQuery components which is attached to that
DataSource:
Master -> MasterDataSource -> Slave
Slave is an update statement, but my point is demonstrated
with select queries as well.
Let's make an example:
master is select id from mastertable
slave is update someothertable where someid = :id and foo = :foo
If I do
slave.ParamByName('foo').AsString := 'bar';
slave.ExecSQL;
the result is wrong because the ID param value is not fetched from the
master.
If I do
slave.ParamByName('id').AsString :=
master.FieldByName('id').AsString;
slave.ParamByName('foo').AsString := 'bar';
slave.ExecSQL;
of course it works.
If slave has only params named after fields in the master (ie no
custom params) then it works. In other words, adding a custom param
prevents fetching the master values.
Needless to say it works beautifully under the BDE.
As usual I have put up a simple test case that shows the problem at the click
of a button with the employee database. I am starting to turn into a
test case coder. ;-)
Ciao
--
Nando mailto:nandod@...