# Class: SqlFieldsCursor

## SqlFieldsCursor

Class representing a cursor to obtain results of SQL Fields query operation.

The class has no public constructor. An instance of this class is obtained via query() method of CacheClient objects. One instance of this class returns results of one SQL Fields query operation.

Source:
  - Cursor.js, line 205

### Extends

- Cursor

### Methods

#### (async) close()

Closes the cursor. Obtaining elements from the results is not possible after this.

This method should be called if no more elements are needed. It is not neccessary to call it if all elements have been already obtained.

Inherited From:
  - Cursor#close
Source:
  - Cursor.js, line 101

#### (async) getAll() → {Promise.<Array.<Array.<*>>>}

Returns all elements (arrays with values of the fields) from the query results.

May be used instead of getValue() method if the number of returned elements is relatively small and will not cause memory utilization issues.

Overrides:
  - Cursor#getAll
Source:
  - Cursor.js, line 234

##### Returns:

- all results returned by SQL Fields query. Every element of the array is an array with values of the fields requested by the query.

Type
  Promise.<Array.<Array.<*>>>

#### getFieldNames() → {Array.<string>}

Returns names of the fields which were requested in the SQL Fields query.

Empty array is returned if "include field names" flag was false in the query.

Source:
  - Cursor.js, line 246

##### Returns:

- field names. The order of names corresponds to the order of field values returned in the results of the query.

Type
  Array.<string>

#### (async) getValue() → {Promise.<Array.<*>>}

Returns one element (array with values of the fields) from the query results.

Every new call returns the next element from the query results. If the method returns null, no more elements are available.

Overrides:
  - Cursor#getValue
Source:
  - Cursor.js, line 218

##### Returns:

- array with values of the fields requested by the query.

Type
  Promise.<Array.<*>>

#### hasMore() → {boolean}

Checks if more elements are available in the query results.

Inherited From:
  - Cursor#hasMore
Source:
  - Cursor.js, line 65

##### Returns:

- true if more cache entries are available, false otherwise.

Type
  boolean

#### setFieldTypes(…fieldTypes) → {SqlFieldsCursor}

Specifies types of the fields returned by the SQL Fields query.

By default, a type of every field is not specified that means during operations the Ignite client will try to make automatic mapping between JavaScript types and Ignite object types - according to the mapping table defined in the description of the ObjectType class.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`fieldTypes` | ObjectType.PRIMITIVE_TYPE | CompositeType | <repeatable> | types of the returned fields. The order of types must correspond the order of field values returned in the results of the query. A type of every field can be: either a type code of primitive (simple) type or an instance of class representing non-primitive (composite) type or null (means the type is not specified)

Source:
  - Cursor.js, line 266

##### Returns:

- the same instance of the SqlFieldsCursor.

Type
  SqlFieldsCursor