reset()

Read(312) Label: reset,

Here’s how to use reset() function.

cs.reset()

Description:

Reset a cursor by moving it back to the beginning.

Syntax:

cs.reset()

Note:

The function resets a cursor by moving it back to the beginning when it traverses data to the end.

Parameters:

cs

A cursor

Return value:

The cursor itself

Example:

 

A

 

1

=demo.cursor("select * from scores")

Return retrieved data as a cursor

2

=A1.fetch()

Fetch data from the cursor

3

=A1.fetch()

Return null because A1’s cursor has come to the end of the data

4

=A1.reset()

Move the cursor back to the beginning

5

=A1.fetch()

Fetch data out of the cursor; returned result is the same as A2

Related functions:

cs.skip(0)

f.reset()

Description:

Copy a composite table file to another composite table file.

Syntax:

f.reset(f’,p,pw:pr)

 

Note:

 The function copies encrypted composite table file f, whose write password is p, to another composite table file f’, whose write password is pwand read password is pr, without copying the index.

If parameter f’ is absent, re-arrange f, re-create an index for it, and resize the length of its column segments according to the data amount.

Parameters:

f

f’

A composite table file/multi-zone composite table

The new composite table file

p

The write password of the copied composite table; won’t encrypt the file if it is absent

pw

The write password of the new composite table; when it is absent, the read password must be omitted

pr

The read password of the new composite table; can be omitted; when the write password is present, this read password can be omitted

Options:

@u

Write the file as an uncompressed one; perform the write as usual if the parameter is omitted

@z

Write the file as a compressed one; won’t perform compression if the option is absent

@r

Write the file by row; perform the write as usual if the parameter is omitted

@c

Write the file by column

@q

A quick reset that doesn’t change the way of segmention, the way of storage, and the password of the original composite table file but that only merges the newly-added data to the column data; doesn’t work with parameter f’ . Won’t merge the patch file with the existing data while the default operation is to perform the merge

@n

Generate an empty same-structure composite table file

Return value:

Boolean value

Example:

 

A

 

1

=file("D:\\test1.ctx")

Open an existing composite table file

2

=A1.reset(file("D:\\e1.ctx"))

Copy the composite table to e1.ctx

3

=A1.reset@z(file("D:\\e2.ctx"))

Copy the composite table as a segmented file

4

=A1.reset@c(file("D:\\e3.ctx"))

Copy the composite table as a file stored by column

5

=A1.reset@u(file("D:\\e4.ctx"))

Copy the composite table as an unsegmented file

6

=A1.reset()

Clear test1.ctx and re-create index for it

7

=A1.reset@r(file("D:\\e5.ctx"))

Copy the composite table as a file stored by row

8

=file("D:\\test6.ctx")

An encrypted composite table, whose write password is !@*123

9

=A1.reset(file("D:\\test7.ctx"),"!@*123","11":"12")

Copy the encrypted composite table file test6 into test7.ctx; the new write password is 11 and the new read password is 12

10

=file("D:\\emp12.ctx")

 

11

=A10.create()

Create a composite table file; below is the base table:

12

=create(EID,NAME).record([4,"Emily"])

13

=A11.delete(A12)

Delete A12’s record from the composite table

14

=A11.close()

Close the composite table

15

=A10.reset@q()

A quick reset of the composite table file

16

=A1.reset@n(file("D:\\e6.ctx"))

With @n option, the function generates an empty same-structure composite table file

 

T.reset()

Description:

Clear the members of a table sequence.

Syntax:

T.reset()

Note:

The function clears members from table sequence T, but reserves the data structure.

Parameters:

T

A table sequence

Return value:

The empty table sequence T.

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE")

2

=A1.reset()