# Class: SqlFieldsQuery

## SqlFieldsQuery(sql)

Class representing an SQL Fields query.

## Constructor

#### new SqlFieldsQuery(sql)

Public constructor.

Requires SQL query string to be specified. Other SQL Fields query settings have the following defaults:

        SQL Fields Query setting  :    Default value
        Local query flag          :    false
        Cursor page size          :    1024
        Query arguments           :    not specified
        Distributed joins flag    :    false
        Replicated only flag      :    false
        Timeout                   :    0 (disabled)
        Schema for the query      :    not specified
        Max rows                  :    -1
        Statement type            :    STATEMENT_TYPE.ANY
        Enforce join order flag   :    false
        Collocated flag           :    false
        Lazy query execution flag :    false
        Include field names flag  :    false

Every setting may be changed using set methods.

##### Parameters:

Name | Type | Description
--- | --- | ---
`sql` | string | SQL query string.

Source:
  - Query.js, line 279

### Extends

- SqlQuery

### Members

#### (static, readonly) STATEMENT_TYPE

Statement type of SQL Fields query.

##### Properties:

Name | Type | Description
--- | --- | ---
`ANY` |  | 0
`SELECT` |  | 1
`UPDATE` |  | 2

Source:
  - Query.js, line 259

### Methods

#### setArgs(…args) → {SqlQuery}

Set query arguments.

Type of any argument may be specified using setArgTypes() method. If type of an argument is not specified then 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
--- | --- | --- | ---
`args` | * | <repeatable> | Query arguments.

Inherited From:
  - SqlQuery#setArgs
Source:
  - Query.js, line 154

##### Returns:

- the same instance of the SqlQuery.

Type
  SqlQuery

#### setArgTypes(…argTypes) → {SqlQuery}

Specifies types of query arguments.

Query arguments itself are set using setArgs() method. By default, a type of every argument 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
--- | --- | --- | ---
`argTypes` | ObjectType.PRIMITIVE_TYPE | CompositeType | <repeatable> | types of Query arguments. The order of types must follow the order of arguments in the setArgs() method. A type of every argument 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)

Inherited From:
  - SqlQuery#setArgTypes
Source:
  - Query.js, line 176

##### Returns:

- the same instance of the SqlQuery.

Type
  SqlQuery

#### setCollocated(collocated) → {SqlFieldsQuery}

Set collocated flag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`collocated` | boolean | collocated flag: true or false.

Source:
  - Query.js, line 379

##### Returns:

- the same instance of the SqlFieldsQuery.

Type
  SqlFieldsQuery

#### setDistributedJoins(distributedJoins) → {SqlQuery}

Set distributed joins flag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`distributedJoins` | boolean | distributed joins flag: true or false.

Inherited From:
  - SqlQuery#setDistributedJoins
Source:
  - Query.js, line 188

##### Returns:

- the same instance of the SqlQuery.

Type
  SqlQuery

#### setEnforceJoinOrder(enforceJoinOrder) → {SqlFieldsQuery}

Set enforce join order flag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`enforceJoinOrder` | boolean | enforce join order flag: true or false.

Source:
  - Query.js, line 367

##### Returns:

- the same instance of the SqlFieldsQuery.

Type
  SqlFieldsQuery

#### setIncludeFieldNames(includeFieldNames) → {SqlFieldsQuery}

Set include field names flag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`includeFieldNames` | boolean | include field names flag: true or false.

Source:
  - Query.js, line 403

##### Returns:

- the same instance of the SqlFieldsQuery.

Type
  SqlFieldsQuery

#### setLazy(lazy) → {SqlFieldsQuery}

Set lazy query execution flag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`lazy` | boolean | lazy query execution flag: true or false.

Source:
  - Query.js, line 391

##### Returns:

- the same instance of the SqlFieldsQuery.

Type
  SqlFieldsQuery

#### setLocal(local) → {Query}

Set local query flag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`local` | boolean | local query flag: true or false.

Inherited From:
  - Query#setLocal
Source:
  - Query.js, line 44

##### Returns:

- the same instance of the Query.

Type
  Query

#### setMaxRows(maxRows) → {SqlFieldsQuery}

Set max rows.

##### Parameters:

Name | Type | Description
--- | --- | ---
`maxRows` | number | max rows.

Source:
  - Query.js, line 343

##### Returns:

- the same instance of the SqlFieldsQuery.

Type
  SqlFieldsQuery

#### setPageSize(pageSize) → {Query}

Set Cursor page size.

##### Parameters:

Name | Type | Description
--- | --- | ---
`pageSize` | number | cursor page size.

Inherited From:
  - Query#setPageSize
Source:
  - Query.js, line 56

##### Returns:

- the same instance of the Query.

Type
  Query

#### setReplicatedOnly(replicatedOnly) → {SqlQuery}

Set replicated only flag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`replicatedOnly` | boolean | replicated only flag: true or false.

Inherited From:
  - SqlQuery#setReplicatedOnly
Source:
  - Query.js, line 200

##### Returns:

- the same instance of the SqlQuery.

Type
  SqlQuery

#### setSchema(schema) → {SqlFieldsQuery}

Set schema for the query.

##### Parameters:

Name | Type | Description
--- | --- | ---
`schema` | string | schema for the query.

Source:
  - Query.js, line 331

##### Returns:

- the same instance of the SqlFieldsQuery.

Type
  SqlFieldsQuery

#### setSql(sql) → {SqlQuery}

Set SQL query string.

##### Parameters:

Name | Type | Description
--- | --- | ---
`sql` | string | SQL query string.

Inherited From:
  - SqlQuery#setSql
Source:
  - Query.js, line 136

##### Returns:

- the same instance of the SqlQuery.

Type
  SqlQuery

#### setStatementType(type) → {SqlFieldsQuery}

Set statement type.

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | SqlFieldsQuery.STATEMENT_TYPE | statement type.

Source:
  - Query.js, line 355

##### Returns:

- the same instance of the SqlFieldsQuery.

Type
  SqlFieldsQuery

#### setTimeout(timeout) → {SqlQuery}

Set timeout.

##### Parameters:

Name | Type | Description
--- | --- | ---
`timeout` | number | timeout value in milliseconds. Must be non-negative. Zero value disables timeout.

Inherited From:
  - SqlQuery#setTimeout
Source:
  - Query.js, line 213

##### Returns:

- the same instance of the SqlQuery.

Type
  SqlQuery

#### setType(type) → {SqlQuery}

Set name of a type or SQL table.

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | string | name of a type or SQL table.

Inherited From:
  - SqlQuery#setType
Source:
  - Query.js, line 118

##### Returns:

- the same instance of the SqlQuery.

Type
  SqlQuery