reset()

Read(259) 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. If parameters p,pw:pr are absent, the to-be-copied composite table is unencrypted and the new composite table is also unencrypted; if parameter p is absent but parameters pw:pr are present, the to-be-copied composite table is unencrypted but the new composite table is encrypted; if parameter p is present but parameters pw:pr are absent, the to-be-copied composite table is encrypted but the new composite table is unencrypted.

Parameters:

f

f’

A composite table file

The new composite table file

p

The write password of the copied composite table

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’

@n

Generate an empty same-structure composite table file

@m

Combine contents of all the other files into the first one when parameter f is a file group and empty (but don’t delete) those other files

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(file("D:\\e6.ctx"))

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

17

=file(["D:\\emp10.ctx","D:\\emp13.ctx"])

A file group

18

=A17.reset@m(file(["D:\\empp3.ctx","D:\\empp4.ctx"]))

With @m option, the function combines all files into the first file and empty the other files

 

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()