Generate an in-memory table from a cursor.
Syntax:
cs.memory(K,…)
Note:
The function generates an in-memory table, whose key is K, from a cursor. When parameter K is absent, the newly-generated in-memory table will inherit the cursor’s key.
Parameter:
K |
The key. |
cs |
A cursor. |
Option:
@p |
Group the would-be in-memory table by the first field; this requires that the cursor is ordered by the first field. |
@v |
The option requires that data in the cursor should be of a pure table sequence and it enables to return a column-wise in-memory table. |
@x |
Automatically close the cursor after the in-memory table is generated. |
Return value:
In-memory table
Example:
|
A |
|
1 |
=demo.cursor("select EID,NAME,GENDER,SALARY from EMPLOYEE where EID<10") |
Return the cursor with retrieved data. |
2 |
=A1.memory(EID) |
Return an in-memory table whose key is EID.
|
|
A |
|
1 |
=connect("demo").query("select EID,NAME,GENDER,SALARY from employee").sort(EID ) |
Return a table sequence ordered by EID. |
2 |
=A1.cursor() |
Return a cursor. |
3 |
=A2.memory@p(EID) |
Generate an in-memory table from A2’s cursor, which is segmented by the first field EID. |
Generate a column-wise in-memory table:
|
A |
|
1 |
=to(1000).new(~:ID,~*~:pNum) |
Generate a table sequence of the following structure:
|
2 |
=A1.cursor() |
Generate a cursor that contains a pure table sequence. |
3 |
=A2.memory@v() |
@v option enables to generate a column-wise in-memory table. |