cdc_merge()

Read(31) Label: summary, insert, delete, modify,

Description:

Record the final updated data in a table when data synchronization tool is used to perform summary.

Syntax:

cdc_merge(cdcPath; table, startTime[,endTime])   

Note:

External library function (See External Library Guide).

 

The function merges data added, deleted and modified in one of the zone tables of a multizone composite table, and returns the final updated data.

Parameter:

cdcPath

The path of dirout folder, which stores the multizone composite table generated from data collection by the data synchronization tool.

table

Table name (only support a single table); cannot be omitted.

startTime/endTime

The starting and ending time of data collection. The format is yyyy-MM-dd HH:mm:dd or yyyy-MM-dd. startTime cannot be omitted. When endTime is absent, use the current time. When both parameters are present, the value is a left-closed, right-open interval.

Return value:

Table sequence

Example:

 

A

 

1

=cdc_merge("D:/tmp/dirout";"mytest.test1","2023-06-01 08:00:00","2023-06-01 10:00:00")

Modify record of table test1 where EID is 19 in the specified period of time, add a record whose EID is 21, merge the operations, and return the result:

2

=cdc_merge("D:/tmp/dirout";"mytest.test1","2023-06-01 08:00:00","2023-06-01 12:00:00")

Modify records where EIDs are 15 and 16, add a record whose EID is 22, delete the record where EID is 21, and return the final existing data:

3

=file("F://tmp/emp1.ctx").open()

Open composite table emp1.ctx; its content is as follows:

4

=A3.update(A2)

Update A2’s data to A3.

5

=A3.cursor().fetch()

Check data in composite table emp1.ctx and find data is correctly synced: