org.apache.ignite.cache.query

## Class SqlQuery<K,V>

- java.lang.Object
- - org.apache.ignite.cache.query.Query<javax.cache.Cache.Entry<K,V>>
  - - org.apache.ignite.cache.query.SqlQuery<K,V>

All Implemented Interfaces:
  Serializable

    public final class SqlQuery<K,V>
    extends Query<javax.cache.Cache.Entry<K,V>>

SQL Query.

See Also:
  `IgniteCache.query(Query)`, Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.cache.query.Query

`DFLT_PAGE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`SqlQuery(Class<?> type, String sql)` Constructs query for the given type and SQL query.
`SqlQuery(String type, String sql)` Constructs query for the given type name and SQL query.

### Method Summary

Methods
`Object[]` `getArgs()` Gets SQL arguments.
`String` `getSql()` Gets SQL clause.
`String` `getType()` Gets type for query.
`boolean` `isDistributedJoins()` Check if distributed joins are enabled for this query.
`SqlQuery<K,V>` `setArgs(Object... args)` Sets SQL arguments.
`SqlQuery` `setDistributedJoins(boolean distributedJoins)` Specify if distributed joins are enabled for this query.
`SqlQuery<K,V>` `setLocal(boolean loc)` Sets whether this query should be executed on local node only.
`SqlQuery<K,V>` `setPageSize(int pageSize)` Sets optional page size, if `0`, then default is used.
`SqlQuery<K,V>` `setSql(String sql)` Sets SQL clause.
`SqlQuery` `setType(Class<?> type)`
`SqlQuery<K,V>` `setType(String type)` Sets type for query.
`String` `toString()`

### Methods inherited from class org.apache.ignite.cache.query.Query

`getPageSize, isLocal`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SqlQuery

    public SqlQuery(String type,
            String sql)

Constructs query for the given type name and SQL query.

Parameters:
  `type` - Type.
  `sql` - SQL Query.

#### SqlQuery

    public SqlQuery(Class<?> type,
            String sql)

Constructs query for the given type and SQL query.

Parameters:
  `type` - Type.
  `sql` - SQL Query.

### Method Detail

#### getSql

    public String getSql()

Gets SQL clause.

Returns:
  SQL clause.

#### setSql

    public SqlQuery<K,V> setSql(String sql)

Sets SQL clause.

Parameters:
  `sql` - SQL clause.
Returns:
  `this` For chaining.

#### getArgs

    public Object[] getArgs()

Gets SQL arguments.

Returns:
  SQL arguments.

#### setArgs

    public SqlQuery<K,V> setArgs(Object... args)

Sets SQL arguments.

Parameters:
  `args` - SQL arguments.
Returns:
  `this` For chaining.

#### getType

    public String getType()

Gets type for query.

Returns:
  Type.

#### setType

    public SqlQuery<K,V> setType(String type)

Sets type for query.

Parameters:
  `type` - Type.
Returns:
  `this` For chaining.

#### setPageSize

    public SqlQuery<K,V> setPageSize(int pageSize)

Sets optional page size, if `0`, then default is used.

Overrides:
  `setPageSize` in class `Query<javax.cache.Cache.Entry<K,V>>`
Parameters:
  `pageSize` - Optional page size.
Returns:
  `this` for chaining.

#### setLocal

    public SqlQuery<K,V> setLocal(boolean loc)

Sets whether this query should be executed on local node only.

Overrides:
  `setLocal` in class `Query<javax.cache.Cache.Entry<K,V>>`
Parameters:
  `loc` - Local flag.
Returns:
  `this` for chaining.

#### setType

    public SqlQuery setType(Class<?> type)

Parameters:
  `type` - Type.
Returns:
  `this` For chaining.

#### setDistributedJoins

    public SqlQuery setDistributedJoins(boolean distributedJoins)

Specify if distributed joins are enabled for this query. When disabled, join results will only contain colocated data (joins work locally). When enabled, joins work as expected, no matter how the data is distributed.

Parameters:
  `distributedJoins` - Distributed joins enabled.
Returns:
  `this` For chaining.

#### isDistributedJoins

    public boolean isDistributedJoins()

Check if distributed joins are enabled for this query.

Returns:
  `true` If distributed joind enabled.

#### toString

    public String toString()

Overrides:
  `toString` in class `Query<javax.cache.Cache.Entry<K,V>>`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.7.0
Release Date | : August 1 2016