Incremental Parent-Child Operation
To support incremental parent-child operations, each child row has an opcode, that is, an extra ADB_OPCODE field that is added to the child schema. The opcode ADB_OPCODE_BYPASS is used to bypass the current table operation. The adapter determines if the operation is an incremental parent-child operation by checking the first level child opcode. If the first level child opcode is not set, the adapter treats it as a complete operation. For the subsequent child level, if the child opcode is not set, it will inherit the parent opcode.
Mixed parent-child operations are also supported. You can send a message to insert new child rows, update other child rows, and delete other child rows for an existing parent-child object.
Note: When working with parent-child table, the value of ADB_OPCODE in the parent table and the child table must be the same. Or only set the value of ADB_OPCODE in the parent table and leave the child table empty.
The following example shows a mixed parent-child operation:
adb.key
{
RVMSG_INT 2 ^type^ 1
RVMSG_INT 2 ^pfmt^ 10
RVMSG_INT 2 ^ver^ 30
RVMSG_INT 2 ^encoding^ 1
RVMSG_RVMSG 110 ^prefixList^
{
RVMSG_STRING 49 1 "/tibco/public/sequence/ae/class/ae/ADB/abc"
RVMSG_STRING 37 default "/tibco/public/class/ae/ADB/abc"
}
RVMSG_RVMSG 77 ^tracking^
{
RVMSG_STRING 30 ^id^ "Gi2--4--DGMSk--s-064zzw8L-zzw"
RVMSG_STRING 22 ^1^ "adb.key"
}
RVMSG_RVMSG 1200 ^data^
{
RVMSG_STRING 8 ^class^ "S_KEYP1"
RVMSG_INT 4 ADB_OPCODE 10
RVMSG_RVMSG 480 ADB_SEQUENCE_S_KEYP2
{
RVMSG_STRING 18 ^class^ "sequence[S_KEYP2]"
RVMSG_INT 4 ^idx^ 1
RVMSG_RVMSG 210 ^1^
{
RVMSG_STRING 8 ^class^ "S_KEYP2"
RVMSG_INT 4 ADB_OPCODE 10
RVMSG_RVMSG 119 ADB_SEQUENCE_S_KEYP3
{
RVMSG_STRING 18 ^class^ "sequence[S_KEYP3]"
RVMSG_INT 4 ^idx^ 1
RVMSG_RVMSG 58 ^1^
{
RVMSG_STRING 8 ^class^ "S_KEYP3"
RVMSG_INT 4 ADB_OPCODE 4
RVMSG_REAL 8 A 1
RVMSG_STRING 2 B "a"
RVMSG_REAL 8 C 4
}
RVMSG_RVMSG 58 ^2^
{
RVMSG_STRING 8 ^class^ "S_KEYP3"
RVMSG_INT 4 ADB_OPCODE 3
RVMSG_REAL 8 A 1
RVMSG_STRING 2 B "a"
RVMSG_REAL 8 C 4
}
}
}
RVMSG_RVMSG 210 ^2^
{
RVMSG_STRING 8 ^class^ "S_KEYP2"
RVMSG_INT 4 ADB_OPCODE 1
RVMSG_REAL 8 A 2
RVMSG_STRING 2 B "a"
RVMSG_REAL 8 C 4
RVMSG_RVMSG 119 ADB_SEQUENCE_S_KEYP3
{
RVMSG_STRING 18 ^class^ "sequence[S_KEYP3]"
RVMSG_INT 4 ^idx^ 1
RVMSG_RVMSG 58 ^1^
{
RVMSG_STRING 8 ^class^ "S_KEYP3"
RVMSG_REAL 8 A 2
RVMSG_STRING 2 B "a"
RVMSG_REAL 8 C 4
}
}
}
}
}
}
When the adapter receives this message, it performs the following database operations in sequence:
Procedure
|
1.
|
Bypass the parent table operation. |
|
2.
|
Bypass first row operation on child table S_KEYP2. |
|
3.
|
UPDATE S_KEYP3 set B = 'a', C = 4 where A = 1;
|
|
4.
|
DELETE FROM S_KEYP3 where A = 1;
|
|
5.
|
INSERT INTO S_KEYP2 (A, B, C) values (2, 'a', 4);
|
|
6.
|
INSERT INTO S_KEYP3 (A, B, C) values (2, 'a', 4); |