Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Master/Detail problem. Come on guys & dolls!!

Status
Not open for further replies.

delphiman

Programmer
Dec 13, 2001
422
ZA
I am absolutely gob-smacked to find that (apparently) nobody, in the entire
IT-Industry World-wide, uses a Master/Detail relationhips in a GDB database.This just can't be true!! :-(

So there must be a way of handling it.

In none of the (pretty expensive) books which I have is it handled either. :-(

Come on guys and dolls!! Surely somebody must be handling this problem??? :)

In which event please refer to my thread102-296246 written on 18 Jun 2000 already and let's have some kind guru give us feedback. Even kinder - a solution. :) :)

With regard to my thread102-296246 I might mention that

1.
I am unhappy about the use of ApplyDates ( as I do there) simply
because of the traffic created to the Server (possibly in Sydney) -
every time some pretty little thing (in Perth) scrolls in the ParentGrid in her GUI.

2.
The Delete problem is solved by creating a Procedure for it. As in


CREATE EXCEPTION CHILD_EXISTS 'Children exist for this parent.';

CREATE PROCEDURE DELETE_PARENT
(
PARENT_NUM SMALLINT
)
AS
BEGIN EXIT; END ^

And ....

ALTER PROCEDURE DELETE_PARENT
(
PARENT_NUM SMALLINT
)
AS
DECLARE VARIABLE any_child INTEGER;
BEGIN
any_kids = 0;

/*
* If there are any children records referencing this parent,
* can't delete the parent until the children are re-assigned
* to another parent or changed to NULL.
*/
SELECT count(PARENT_NO)
FROM CHILD
WHERE PARENT_NO = :pARENT_NUM
INTO :any_kids;

IF (any_kids > 0) THEN
BEGIN
EXCEPTION CHILD_EXISTS;
SUSPEND;
END

/*
* Delete the parent from any projects.
*/
DELETE FROM parent_proj
WHERE parent_no = :parent_num;

/*
* Delete old parent records.
*/
DELETE FROM PARENT
WHERE PARENT_NO = :pARENT_NUM;

SUSPEND;
END
^

 
I can't get to the previous thread.

Please state what you want solved: is it an InterBase problem or a Delphi/BDE problem?

Cheers
 
Thanks Mate!

But I have since cracked the problem. Should anyone want a
working model I'll gladly e-mail it to them.

I can be contacted directly at delphiman@bigpond.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top