Subject Re: [IBO] IB_Query.Locate problem
Author Helen Borrie
At 01:19 PM 18/07/2004 +0000, you wrote:
>I have 2 tables:
>CREATE TABLE dep (
> id_dep INTEGER NOT NULL,
> name VARCHAR(50) NOT NULL,
> CONSTRAINT dep_pk PRIMARY KEY (id_dep)
>);
>
>CREATE TABLE person (
> id_person INTEGER NOT NULL,
> name VARCHAR(50) NOT NULL,
> id_dep INTEGER NOT NULL,
> CONSTRAINT person_pk PRIMARY KEY (id_person)
>);
>
>I have an IB_QueryDep as master and an IB_QueryPerson as detail.
>If I make an
>IB_QueryPerson.Locate('name', VarArrayOf(['michael']), []))
>the locate fails even if michael exists.
>The locate fails because the generated sql for locate looks like this:
>SELECT person.id_person
>FROM
> person
>WHERE person.id_dep=? /* BIND_0 */
> AND person.id_dep=? /* MLNK_ID_DEP_0 */
> AND (((PERSON.NAME = ? /* LOC_1_PERSON_NAME */ )))
>
>and as parameters values:
> [BIND_0] = <n> 0
> [MLNK_ID_DEP_0] = 2
> [LOC_1_PERSON_NAME] = 'michael' ]
>
>But the sql should have been:
>SELECT person.id_person
>FROM
> person
>WHERE
> person.id_dep=? /* MLNK_ID_DEP_0 */
> AND (((PERSON.NAME = ? /* LOC_1_PERSON_NAME */ )))
>
>or the parameter values should have been:
> [BIND_0] = 2
> [MLNK_ID_DEP_0] = 2
> [LOC_1_PERSON_NAME] = 'michael' ]
>
>If I remove the master detail relation then it works ok:
>SELECT person.id_person
>FROM
> person
>WHERE (((PERSON.NAME = ? /* LOC_1_PERSON_NAME */ )))
>
>Where is the problem?
>
>I've included a test-case Problem-IB_Query.Locate.zip:
>http://groups.yahoo.com/group/IBObjects/files/Problem-IB_Query.Locate.
>zip

I looked at your test-case. It certainly looks as if Locate() is
broken. Forwarding it to Jason as a bug report with a good
test-case. Thanks!!

Helen