Here’s how to use mcursor() function.
Description:
Generate a multicursor based on a sequence of cursors.
Syntax:
CS.mcursor()
Note:
The function generates a multicursor based on CS, a sequence of cursors. Every cursor in the cursor sequence must have the same structure. A multicursor having more subcorsors will be generated if CS is a sequence of multicursor.
Parameter:
CS |
A sequence of cursors |
Return value:
Multicursor
Example:
test_mcs.dfx is the deployment file for deploying remote node servers. The nodes are 【"192.168.0.204"," 192.168.0.205","192.168.0.206"】; their port numbers are 8081. Below is the file:
|
A |
1 |
=connect("demo").cursor("select * from SCORES where SUBJECT=?",arg1) |
2 |
return A1 |
|
A |
|
1 |
=callx("test_mcs.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8081","192.168.0.206:8081"]) |
Each of the three parallel nodes returns a cursor to form a cursor sequence |
2 |
=A1.mcursor() |
Generate a multicursor based on the cursor sequence |
3 |
=A2.fetch() |
Fetch all records from the multicursor |
Description:
Generate a multicursor based on one cursor.
Syntax:
cs.mcursor(n)
Note:
The function generates a multicursor based on an ordinary cursor cs, from which data is fetched and stored in n subcursors. Use the value of【Default number of subcursors in a multicursor】set in Tool>Options when n is absent.
Parameter:
cs |
A unicursor |
n |
An integer |
Return value:
Multicursor
Example:
|
A |
|
1 |
=demo.cursor("select * from EMPLOYEE") |
|
2 |
=A1.mcursor(3) |
Create a multicursor |