Adjust data values to clarify distinction between "parent" and "child" values.

This commit is contained in:
Anthony Tuininga 2018-05-18 14:23:54 -06:00
parent c8c44ff698
commit 84ee1301bc
4 changed files with 34 additions and 34 deletions

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# Copyright 2016, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright 2016, 2018, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
@ -32,7 +32,7 @@ for parentId, count in cursor.execute("""
print()
# delete the following parent IDs only
parentIdsToDelete = [2, 3, 5]
parentIdsToDelete = [20, 30, 50]
print("Deleting Parent IDs:", parentIdsToDelete)
print()

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# Copyright 2016, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright 2016, 2018, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
@ -25,14 +25,14 @@ cursor = connection.cursor()
# define data to insert
dataToInsert = [
(1016, 1, 'Child 2 of Parent 1'),
(1017, 1, 'Child 3 of Parent 1'),
(1018, 2, 'Child 4 of Parent 2'),
(1018, 2, 'Child 4 of Parent 2'), # duplicate key
(1019, 3, 'Child 3 of Parent 3'),
(1020, 3, 'Child 4 of Parent 4'),
(1021, 6, 'Child 1 of Parent 6'), # parent does not exist
(1022, 4, 'Child 6 of Parent 4'),
(1016, 10, 'Child B of Parent 10'),
(1017, 10, 'Child C of Parent 10'),
(1018, 20, 'Child D of Parent 20'),
(1018, 20, 'Child D of Parent 20'), # duplicate key
(1019, 30, 'Child C of Parent 30'),
(1020, 30, 'Child D of Parent 40'),
(1021, 60, 'Child A of Parent 60'), # parent does not exist
(1022, 40, 'Child F of Parent 40'),
]
# retrieve the number of rows in the table

View File

@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# Copyright 2016, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright 2016, 2018, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
@ -50,7 +50,7 @@ connection = Connection()
cursor = connection.cursor()
# demonstrate that the subclassed connection and cursor are being used
cursor.execute("select count(*) from ChildTable where ParentId = :1", (3,))
cursor.execute("select count(*) from ChildTable where ParentId = :1", (30,))
count, = cursor.fetchone()
print("COUNT:", int(count))

View File

@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------------
* Copyright 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright 2017, 2018, Oracle and/or its affiliates. All rights reserved.
*---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
@ -202,27 +202,27 @@ begin
end;
/
insert into &main_user..ParentTable values (1, 'Parent 1');
insert into &main_user..ParentTable values (2, 'Parent 2');
insert into &main_user..ParentTable values (3, 'Parent 3');
insert into &main_user..ParentTable values (4, 'Parent 4');
insert into &main_user..ParentTable values (5, 'Parent 5');
insert into &main_user..ParentTable values (10, 'Parent 10');
insert into &main_user..ParentTable values (20, 'Parent 20');
insert into &main_user..ParentTable values (30, 'Parent 30');
insert into &main_user..ParentTable values (40, 'Parent 40');
insert into &main_user..ParentTable values (50, 'Parent 50');
insert into &main_user..ChildTable values (1001, 1, 'Child 1 of Parent 1');
insert into &main_user..ChildTable values (1002, 2, 'Child 1 of Parent 2');
insert into &main_user..ChildTable values (1003, 2, 'Child 2 of Parent 2');
insert into &main_user..ChildTable values (1004, 2, 'Child 3 of Parent 2');
insert into &main_user..ChildTable values (1005, 3, 'Child 1 of Parent 3');
insert into &main_user..ChildTable values (1006, 3, 'Child 2 of Parent 3');
insert into &main_user..ChildTable values (1007, 4, 'Child 1 of Parent 4');
insert into &main_user..ChildTable values (1008, 4, 'Child 2 of Parent 4');
insert into &main_user..ChildTable values (1009, 4, 'Child 3 of Parent 4');
insert into &main_user..ChildTable values (1010, 4, 'Child 4 of Parent 4');
insert into &main_user..ChildTable values (1011, 4, 'Child 5 of Parent 4');
insert into &main_user..ChildTable values (1012, 5, 'Child 1 of Parent 5');
insert into &main_user..ChildTable values (1013, 5, 'Child 2 of Parent 5');
insert into &main_user..ChildTable values (1014, 5, 'Child 3 of Parent 5');
insert into &main_user..ChildTable values (1015, 5, 'Child 4 of Parent 5');
insert into &main_user..ChildTable values (1001, 10, 'Child A of Parent 10');
insert into &main_user..ChildTable values (1002, 20, 'Child A of Parent 20');
insert into &main_user..ChildTable values (1003, 20, 'Child B of Parent 20');
insert into &main_user..ChildTable values (1004, 20, 'Child C of Parent 20');
insert into &main_user..ChildTable values (1005, 30, 'Child A of Parent 30');
insert into &main_user..ChildTable values (1006, 30, 'Child B of Parent 30');
insert into &main_user..ChildTable values (1007, 40, 'Child A of Parent 40');
insert into &main_user..ChildTable values (1008, 40, 'Child B of Parent 40');
insert into &main_user..ChildTable values (1009, 40, 'Child C of Parent 40');
insert into &main_user..ChildTable values (1010, 40, 'Child D of Parent 40');
insert into &main_user..ChildTable values (1011, 40, 'Child E of Parent 40');
insert into &main_user..ChildTable values (1012, 50, 'Child A of Parent 50');
insert into &main_user..ChildTable values (1013, 50, 'Child B of Parent 50');
insert into &main_user..ChildTable values (1014, 50, 'Child C of Parent 50');
insert into &main_user..ChildTable values (1015, 50, 'Child D of Parent 50');
insert into &main_user..SampleQueryTab values (1, 'Anthony');
insert into &main_user..SampleQueryTab values (2, 'Barbie');