T.append(cs)

Read(809) Label: cursor, pseudo table,

Description:

Append-write records of a cursor to a pseudo table.

Syntax:

T.append(cs)

Note:

The function append-writes records of cursor cs to pseudo table T. If the cursor contains pseudo fields, they will be automatically converted to real fields at append-write.

 

Only supported by esProc Enterprise Edition.

Parameter:

T

A pseudo table.

cs

A cursor.

Option:

@y

Write the appended records to the memory instead of keeping it in the external memory.

Return value:

Pseudo table

Example:

Append-write to a pseudo table:

 

A

 

1

=create(file).record(["D:/file/Employee2.ctx"])

 

2

=pseudo(A1)

Generate a pseudo table object.

3

=create(Dept,AvgSalary).record(["CSD",6400.53])

 

Create a table sequence:

4

=A2.append@i(A3.cursor())

Append A3’s cursor record to the pseudo table.

5

>A2.close()

Close the pseudo table.

 

 

 

When the cursor contains pseudo fields:

 

A

 

1

=[{file:"EMPLOYEE.ctx",

column:[{name:"GENDER",

enum:"GENDER_enum",

list:["F","M"]}]}]

Return pseudo table definition record. Below is content of EMPLOYEE.CTX:

2

=pseudo@v(A1)

Generate a pseudo table object.

3

=create(EID,NAME,GENDER_enum).record([11,"Asew","M"])

Generate a table sequence:

4

=A3.cursor()

Return records of A3’s table sequence as a cursor.

5

=A2.append(A4)

Append records of A4’s cursor, where GENDER_enum is a pseudo field, to A2’s pseudo table.

6

=A2.import()

View records of A2’s pseudo table after the append-write, where values of pseudo field GENDER_enum are automatically converted to those of real field GENDER:

7

>A2.close()

Close the pseudo table.

 

Use @y option to write the appended records to the memory:

 

A

 

1

=create(file).record(["em.ctx"])

Return the pseudo table definition record.

2

=pseudo(A1)

Generate a pseudo table definition object.

3

=A2.import()

Read data from the pseudo table.

4

=create(EID,NAME).record([0,"AAAA"])

Return a table sequence:

5

=A2.append@y(A4.cursor())

Append table sequence A4’s records to pseudo table A2; @y option enables converting A4’s data to an in-memory zone table and writing it to the memory.

6

=A2.import()

Import data from the pseudo table, where there are records appended in A5.

7

>A2.close()

Close the pseudo table.

8

=pseudo(A1).import()

Import data from pseudo table A1; as A5 uses @y option and the appended data isn’t written to the external memory, the imported pseudo table data here does not contain A4’s data; the result is the same as A3’s: