BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Nested CDS is updating before Master CDS

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier)
View previous topic :: View next topic  
Author Message
Charles Haron
Guest





PostPosted: Fri Jul 16, 2004 12:56 am    Post subject: Nested CDS is updating before Master CDS Reply with quote



Hello,

I have a CDS with a nested CDS. When I insert new record in the master
CDS, and insert a new detail record in the nested CDS, and then call
applyupdates on the master CDS, the master CDS is updated before the
nested CDS. HOWEVER, If I edit an existing record in the master CDS
and insert new record in the nested CDS (again calling applyudates on
the master CDS), the nested CDS is updated BEFORE the master CDS.

It is critical that the master CDS is updated BEFORE the nested CDS,
because I have an "after insert" trigger on the table associated with
the nested CDS that emails information from both the "detail" and
"master" records.

How in I ensure that the master CDS in ALWAYS updated first?

I'm using D7 pro with the 7.1 update. Below is output from SQLMonitor.

Where "companies" is the master and "rmas" is the detail.

**** This is what is get when I insert a master and detail record ****
Loading PostgreSQL interface Library libpq.dll
Libpq v7.3.3.0: C:WINNTsystem32libpq.dll
Connecting to database tso_test on server 10.3.0.10
pgExpress Driver v2.10 full [6/25/2003 6:01:00 AM]
pgExpress DLL: C:WINNTsystem32dbexppge.dll
SELECT c.date_opened, c.phone, c.id, c.contact, c2.company_name
FROM cases AS c INNER JOIN companies AS c2
ON (c.company_id = c2.company_id)
WHERE c.case_closed = false
ORDER BY c.date_opened ASC;
Got 173 tuples from server
SELECT company_id, company_name FROM companies
ORDER BY company_name;
Got 1547 tuples from server
SELECT company_id, company_name, contact, email, phone,
fax, bill_to, ship_to
FROM companies
WHERE company_id = 0
Got 0 tuples from server
SELECT * FROM rmas
WHERE company_id = NULL
ORDER BY company_id
Got 0 tuples from server
SELECT id, printer_model FROM printer_models
ORDER BY printer_model;
Got 923 tuples from server
SELECT * FROM repair_types
ORDER BY repair_type;
Got 4 tuples from server
SELECT nextval('companies_id_seq');
Got 1 tuples from server
Starting transaction
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;SET DATESTYLE TO ISO;
BEGIN;
insert into "companies"
("company_id", "company_name", "contact", "email", "phone", "fax",
"bill_to", "ship_to")
values
(1665, 'test151649', 'as;flksja;', 'sad;kfasd;l', 's;dkffasd;l', 'sda;
fkljasd;', 'fd;lajgf', 'asd;flkasd')
Command executed sucessfully
1 row(s) affected
insert into "rmas"
("id", "company_id", "repair_types_id", "printer_models_id", "serial_
number", "problem_desc")
values
(151649, 1665, 1, 595, 'adsfsadfasdf', 'PRINTING ERRONOUSLY ')
Command executed sucessfully
1 row(s) affected
Commiting transaction
END;
SELECT company_id, company_name FROM companies
ORDER BY company_name;
Got 1548 tuples from server
SELECT company_id, company_name, contact, email, phone,
fax, bill_to, ship_to
FROM companies
WHERE company_id = 1665
Got 1 tuples from server
SELECT * FROM rmas
WHERE company_id = 1665
ORDER BY company_id
Got 1 tuples from server
SELECT * FROM rmas
WHERE company_id = NULL
ORDER BY company_id
Got 0 tuples from server
***************************************************

**** This is what I get when I edit an existing master record and insert
a detail record****

Loading PostgreSQL interface Library libpq.dll
Libpq v7.3.3.0: C:WINNTsystem32libpq.dll
Connecting to database tso_test on server 10.3.0.10
pgExpress Driver v2.10 full [6/25/2003 6:01:00 AM]
pgExpress DLL: C:WINNTsystem32dbexppge.dll
SELECT c.date_opened, c.phone, c.id, c.contact, c2.company_name
FROM cases AS c INNER JOIN companies AS c2
ON (c.company_id = c2.company_id)
WHERE c.case_closed = false
ORDER BY c.date_opened ASC;
Got 173 tuples from server
SELECT company_id, company_name FROM companies
ORDER BY company_name;
Got 1547 tuples from server
SELECT company_id, company_name, contact, email, phone,
fax, bill_to, ship_to
FROM companies
WHERE company_id = 1645
Got 1 tuples from server
SELECT * FROM rmas
WHERE company_id = 1645
ORDER BY company_id
Got 1 tuples from server
SELECT * FROM rmas
WHERE company_id = NULL
ORDER BY company_id
Got 0 tuples from server
SELECT id, printer_model FROM printer_models
ORDER BY printer_model;
Got 923 tuples from server
SELECT * FROM repair_types
ORDER BY repair_type;
Got 4 tuples from server
Starting transaction
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;SET DATESTYLE TO ISO;
BEGIN;
insert into "rmas"
("id", "company_id", "repair_types_id", "printer_models_id", "serial_
number", "problem_desc")
values
(151645, 1645, 4, 2, 'dasfasdfsad', 'PRINTING ERRONOUSLY ')
Command executed sucessfully
1 row(s) affected
update "companies" set
"ship_to" = 'Glue2'
where
"company_id" = 1645 and
"company_name" = 'Test141530' and
"contact" = 'Joe Bod' and
"email" = 'adsf (AT) adfs (DOT) com' and
"phone" = '1234512345' and
"fax" = '1234512345'
Command executed sucessfully
1 row(s) affected
Commiting transaction
END;
SELECT company_id, company_name FROM companies
ORDER BY company_name;
Got 1547 tuples from server
SELECT company_id, company_name, contact, email, phone,
fax, bill_to, ship_to
FROM companies
WHERE company_id = 1645
Got 1 tuples from server
SELECT * FROM rmas
WHERE company_id = 1645
ORDER BY company_id
Got 2 tuples from server
SELECT * FROM rmas
WHERE company_id = NULL
ORDER BY company_id
Got 0 tuples from server
****************************************************************


Best Regards,
Charles
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.