Functions Locate or LooKup

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Wilton
Posts: 22
Joined: Mon 22 Nov 2004 12:51
Location: São Paulo - Brazil

Functions Locate or LooKup

Post by Wilton » Wed 17 Oct 2007 17:55

Hi,
After install MyDAC 5.20.0.11 for Delphi 5, when i try use
Functions Locate or LooKup and the result is the 1st line in
dataset, this functions doesn't work. What's happen?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 18 Oct 2007 09:51

I could not reproduce the problem.
Please send me a complete small sample at mydac*crlab*com to demonstrate it, including script to create and fill table.

Wilton
Posts: 22
Joined: Mon 22 Nov 2004 12:51
Location: São Paulo - Brazil

Post by Wilton » Tue 23 Oct 2007 12:03

Hi Antaeus,

My problem occurs when I try to execute one lookup in the below described structure. In the VarArrayOf elements, when i have in wnsubit
variable a value number 1 (one) , his don't works, but using others values (like a 2) his works fine.

Code: Select all

 ndatamod.NvouchBkn.Value := ndatamod.Ninvhot.LookUp('npasta;item;subit',VarArrayOf([ndatamod.ninvoicnpasta.Value,ndatamod.ninvoiciteste.Value,wnsubit]),'BKN');

CREATE TABLE `ninvhot` (
  `Npasta` int(6) NOT NULL default '0',
  `Item` int(3) NOT NULL default '0',
  `Subit` int(3) NOT NULL default '0',
  `Qtd` int(3) default NULL,
  `Quarto` char(1) character set latin1 default NULL,
  `Npax` int(3) default NULL,
  PRIMARY KEY  (`Npasta`,`Item`,`Subit`),
  UNIQUE KEY `ninvhot` (`Npasta`,`Item`,`Subit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Data in table
Npasta	Item	Subit	Qtd	Quarto	Npax
541570	1	1	1		2
541570	2	1	1		2

This same behavior occurs using a Locate function

Code: Select all

if ndatamod.Ninvhot.Locate('npasta;item;subit',VarArrayOf([ndatamod.ninvoicnpasta.Value,ndatamod.ninvoiciteste.Value,wnsubit]),[]) then
begin
 ....
end;
Tks,

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 24 Oct 2007 07:39

Thank you for this explanation. I used it to reproduce the problem, but the sample I've created works with no problems. If the wnsubit variable equals to 1 (one), both records can be found for data you posted. The functions cannot find records for other values of wnsubit on this data, as it is expected.

Please prepare a complete small sample that reproduces the problem.

Post Reply