close()

Read(606) Label: close,

Here’s how to use close() function.

cs .close()

Description:

Close a cursor.

Syntax:  

cs.close()

Note:  

The function clears the file handles and database connections used by cursors and their root cursors. By default, all of them will be closed automatically when fetch operation finishes.

Parameters:

cs

A cursor

Example:

 

A

 

1

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

Return a cursor of retrieved data

2

=A1.fetch(10)

Retrieve some records

3

=A1.close()

Close the cursor

Related functions:

cs.fetch()

db.cursor()

db .close()

Description:

Close a datasource connection.

Syntax:

db.close()

Note:

Close a database connection. By default, data will be committed before closing the database.

Parameters:

db

Database connection, which supports esproc-JDBC source

Example:

 

A

 

1

=connect("demo")

 

2

>A1.close()

Close the connection to database demo

Note:

connect and close must be used in pairs; otherwise, the connection cannot be closed.

Related functions:

connect()

db.error()

db.commit()

db.rollback()

T.close()

Description:

Close a composite table.

Syntax:

T.close()

Note:

The function closes an entity table and its attached tables in a composite table. The operation is not a necessity when there isn’t a write operation.

Parameters:

T

A composite table.

Example:

 

A

 

1

=connect("demo").cursor("select EID,NAME,GENDER,SALARY  from employee")

Return a single cusor

2

=file("emp.ctx")

Generate a composite table

3

=A2.create(#EID,NAME,GENDER,SALARY)

Create A2’s base table

4

=A3.append(A1)

Append data of A1’s cursor to the base table

5

=A3.close()

Close the composite table

 

T.close()

Description

Close a cluster table.

Syntax:

T.close()

Note:

The function closes a cluster table. It clears memory when T is a cluster in-memory table created by T.memory().

Parameters:

T

A cluster table

Example:

 

A

 

1

=file("dept.ctx":[1],["192.168.0.104:8281"])

 

2

=A1.open()

Open a cluster table

3

=A2.attach(t1)

Return an existing attached table t1 in A2’ composite table

4

=A2.memory(DEPTID,DEPTNAME;DEPTID<10)

Generate a cluster in-memory table from table t1

5

=A2.close()

Close the cluster table and clear memory