Subject RE: [IBO] Record not located to delete
Author Dion Oliphant
Hi,

My Meta data:-

There are two entries :-

FundId FundName UnderWriterId
------ -------- -------------
4 FUND 1 10
5 FUND 2 12


CREATE TABLE "FUND"
(
"FUNDID" INTEGER NOT NULL,
"FUNDNAME" VARCHAR(50) NOT NULL,
"UNDERWRITERID" INTEGER NOT NULL,
CONSTRAINT "FUND_PK" PRIMARY KEY ("FUNDID"),
CONSTRAINT "FUND_UN" UNIQUE ("FUNDNAME")
);

ALTER TABLE "FUND" ADD FOREIGN KEY ("UNDERWRITERID") REFERENCES
"UNDERWRITER" ("UNDERWRITERID");
SET TERM ^ ;


/* Triggers only will work for SQL triggers */

CREATE TRIGGER "FUND_KEY" FOR "FUND"
ACTIVE BEFORE INSERT POSITION 0
AS BEGIN
IF ((NEW.FUNDID = 0) OR (NEW.FUNDID IS NULL)) THEN
NEW.FUNDID = GEN_ID(FUND_GEN, 1);
END
^

I expected to receive a "Cannot delete due to referential constraints" or
something similar ...
I have tried a using new(from palette, not copied) TIB_Query and TIB_Grid
components, but to no avail.

Thanks,
Dion.

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Friday, October 04, 2002 9:17 AM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Record not located to delete


At 08:52 AM 04-10-02 +0200, you wrote:
>HI,
>
>I have a query which I populate with the query "Select * from Funds" with
no
>mastersource or keysource. The KeyLinks is "Funds.FundId". I open the
>dataset, but get the following error when trying to delete a record "Record
>not located to delete". Any idea why? It seems to be a straight forward
>request. If I use DeleteSQL string, it works. The error seems to hint at
>"not records affected??

...or more than one candidate record.

Is FundID on its own the primary key, or otherwise unique in the
table? Dataset deletes and updates are searched, that is, they operate on
the single record currently pointed to by the buffer cursor. Perhaps your
DeleteSQL string works because it is performing a positioned update, that
is, deleting all records in the table where FundID = :fundID...

If FundID is part of a composite PK, then you must include all of the PK
columns in KeyLinks.

Helen



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/