| Apache Ignite C++

Public Member Functions | Friends | List of all members
ignite::thin::cache::query::SqlFieldsQuery Class Reference

SQL fields query for thin client. More...

`#include <query_sql_fields.h>`

## Public Member Functions
| SqlFieldsQuery (const std::string &sql)
| Constructor. More...
| SqlFieldsQuery (const SqlFieldsQuery &other)
| Copy constructor. More...
SqlFieldsQuery & | operator= (const SqlFieldsQuery &other)
| Assignment operator. More...
| ~SqlFieldsQuery ()
| Destructor.
void | Swap (SqlFieldsQuery &other)
| Efficiently swaps contents with another SqlQuery instance. More...
const std::string & | GetSql () const
| Get SQL string. More...
void | SetSql (const std::string &sql)
| Set SQL string. More...
void | SetSchema (const std::string &schema)
| Set schema name for the query. More...
const std::string & | GetSchema () const
| Get schema name for the query. More...
int32_t | GetPageSize () const
| Get page size. More...
void | SetPageSize (int32_t pageSize)
| Set page size. More...
void | SetMaxRows (int32_t maxRows)
| Set maximum number of rows. More...
int32_t | GetMaxRows () const
| Get maximum number of rows. More...
void | SetTimeout (int64_t timeout)
| Set query execution timeout in milliseconds. More...
int64_t | GetTimeout () const
| Get query execution timeout in milliseconds. More...
bool | IsLocal () const
| Get local flag. More...
void | SetLocal (bool loc)
| Set local flag. More...
bool | IsDistributedJoins () const
| Check if distributed joins are enabled for this query. More...
void | SetDistributedJoins (bool enabled)
| Specify if distributed joins are enabled for this query. More...
bool | IsEnforceJoinOrder () const
| Checks if join order of tables if enforced. More...
void | SetEnforceJoinOrder (bool enforce)
| Sets flag to enforce join order of tables in the query. More...
bool | IsLazy () const
| Gets lazy query execution flag. More...
void | SetLazy (bool lazy)
| Sets lazy query execution flag. More...
bool | IsCollocated ()
| Checks if this query is collocated. More...
void | SetCollocated (bool collocated)
| Sets flag defining if this query is collocated. More...
const std::vector< int32_t > & | GetPartitions () const
| Get partitions for the query. More...
void | SetPartitions (const std::vector< int32_t > &partitions)
| Set partitions for the query. More...
void | SetUpdateBatchSize (int32_t size)
| Set batch size for update queries. More...
int32_t | GetUpdateBatchSize () const
| Get batch size for update queries. More...
template<typename T >
void | AddArgument (const T &arg)
| Add argument for the query. More...
template<typename Iter >
void | AddInt8ArrayArgument (Iter begin, Iter end)
| Add int8_t array as an argument. More...
void | ClearArguments ()
| Remove all added arguments.

## Friends
class | ignite::impl::thin::SqlFieldsQueryRequest

## Detailed Description

SQL fields query for thin client.

## Constructor & Destructor Documentation

## ◆ SqlFieldsQuery() [1/2]

ignite::thin::cache::query::SqlFieldsQuery::SqlFieldsQuery | ( | const std::string & | sql | ) |
| inline explicit

Constructor.

Parameters

  sql | SQL string.

## ◆ SqlFieldsQuery() [2/2]

ignite::thin::cache::query::SqlFieldsQuery::SqlFieldsQuery | ( | const SqlFieldsQuery & | other | ) |
| inline

Copy constructor.

Parameters

  other | Other instance.

## Member Function Documentation

## ◆ AddArgument()

template<typename T >

void ignite::thin::cache::query::SqlFieldsQuery::AddArgument | ( | const T & | arg | ) |
| inline

Add argument for the query.

Template Parameters

  T | Type of argument. Should be copy-constructable and assignable. BinaryType class template should be specialized for this type.

Parameters

  arg | Argument.

## ◆ AddInt8ArrayArgument()

template<typename Iter >

void ignite::thin::cache::query::SqlFieldsQuery::AddInt8ArrayArgument | ( | Iter | begin,
|  | Iter | end
| ) |  |
| inline

Add int8_t array as an argument.

Template Parameters

  Iter | Iterator type. Should provide standard iterator functionality.

Parameters

  begin | Begin iterator of sequence to write.
  end | End iterator of sequence to write.

## ◆ GetMaxRows()

int32_t ignite::thin::cache::query::SqlFieldsQuery::GetMaxRows | ( |  | ) | const
| inline

Get maximum number of rows.

Returns
  Max rows.

## ◆ GetPageSize()

int32_t ignite::thin::cache::query::SqlFieldsQuery::GetPageSize | ( |  | ) | const
| inline

Get page size.

Returns
  Page size.

## ◆ GetPartitions()

const std::vector<int32_t>& ignite::thin::cache::query::SqlFieldsQuery::GetPartitions | ( |  | ) | const
| inline

Get partitions for the query.

The query will be executed only on nodes which are primary for specified partitions.

Returns
  Partitions for the query.

## ◆ GetSchema()

const std::string& ignite::thin::cache::query::SqlFieldsQuery::GetSchema | ( |  | ) | const
| inline

Get schema name for the query.

If not set, current cache name is used, which means you can omit schema name for tables within the current cache.

Returns
  Schema. Empty string if not set.

## ◆ GetSql()

const std::string& ignite::thin::cache::query::SqlFieldsQuery::GetSql | ( |  | ) | const
| inline

Get SQL string.

Returns
  SQL string.

## ◆ GetTimeout()

int64_t ignite::thin::cache::query::SqlFieldsQuery::GetTimeout | ( |  | ) | const
| inline

Get query execution timeout in milliseconds.

Returns
  Timeout in milliseconds.

## ◆ GetUpdateBatchSize()

int32_t ignite::thin::cache::query::SqlFieldsQuery::GetUpdateBatchSize | ( |  | ) | const
| inline

Get batch size for update queries.

Returns
  Batch size for update queries.

## ◆ IsCollocated()

bool ignite::thin::cache::query::SqlFieldsQuery::IsCollocated | ( |  | ) |
| inline

Checks if this query is collocated.

Returns
  `true` If the query is collocated.

## ◆ IsDistributedJoins()

bool ignite::thin::cache::query::SqlFieldsQuery::IsDistributedJoins | ( |  | ) | const
| inline

Check if distributed joins are enabled for this query.

Returns
  True If distributed join enabled.

## ◆ IsEnforceJoinOrder()

bool ignite::thin::cache::query::SqlFieldsQuery::IsEnforceJoinOrder | ( |  | ) | const
| inline

Checks if join order of tables if enforced.

Returns
  Flag value.

## ◆ IsLazy()

bool ignite::thin::cache::query::SqlFieldsQuery::IsLazy | ( |  | ) | const
| inline

Gets lazy query execution flag.

See SetLazy(bool) for more information.

Returns
  Lazy flag.

## ◆ IsLocal()

bool ignite::thin::cache::query::SqlFieldsQuery::IsLocal | ( |  | ) | const
| inline

Get local flag.

Returns
  Local flag. If true, query will be executed only on the single connected node, so only local entries will be returned as query result. Should be used with caution because if the client connected to multiple nodes, a single node will be selected randomly.

## ◆ operator=()

SqlFieldsQuery& ignite::thin::cache::query::SqlFieldsQuery::operator= | ( | const SqlFieldsQuery & | other | ) |
| inline

Assignment operator.

Parameters

  other | Other instance.

## ◆ SetCollocated()

void ignite::thin::cache::query::SqlFieldsQuery::SetCollocated | ( | bool | collocated | ) |
| inline

Sets flag defining if this query is collocated.

Collocation flag is used for optimization purposes of queries with GROUP BY statements. Whenever Ignite executes a distributed query, it sends sub-queries to individual cluster members. If you know in advance that the elements of your query selection are collocated together on the same node and you group by collocated key (primary or affinity key), then Ignite can make significant performance and network optimizations by grouping data on remote nodes.

Parameters

  collocated | Flag value.

## ◆ SetDistributedJoins()

void ignite::thin::cache::query::SqlFieldsQuery::SetDistributedJoins | ( | bool | enabled | ) |
| inline

Specify if distributed joins are enabled for this query.

When disabled, join results will only contain collocated data (joins work locally). When enabled, joins work as expected, no matter how the data is distributed.

Parameters

  enabled | Distributed joins enabled.

## ◆ SetEnforceJoinOrder()

void ignite::thin::cache::query::SqlFieldsQuery::SetEnforceJoinOrder | ( | bool | enforce | ) |
| inline

Sets flag to enforce join order of tables in the query.

If set to true query optimizer will not reorder tables in join. By default is false.

It is not recommended to enable this property unless you are sure that your indexes and the query itself are correct and tuned as much as possible but query optimizer still produces wrong join order.

Parameters

  enforce | Flag value.

## ◆ SetLazy()

void ignite::thin::cache::query::SqlFieldsQuery::SetLazy | ( | bool | lazy | ) |
| inline

Sets lazy query execution flag.

By default Ignite attempts to fetch the whole query result set to memory and send it to the client. For small and medium result sets this provides optimal performance and minimize duration of internal database locks, thus increasing concurrency.

If result set is too big to fit in available memory this could lead to excessive GC pauses and even OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory consumption at the cost of moderate performance hit.

Defaults to `false`, meaning that the whole result set is fetched to memory eagerly.

Parameters

  lazy | Lazy query execution flag.

## ◆ SetLocal()

void ignite::thin::cache::query::SqlFieldsQuery::SetLocal | ( | bool | loc | ) |
| inline

Set local flag.

Parameters

  loc | Local flag. If true, query will be executed only on the single connected node, so only local entries will be returned as query result. Should be used with caution because if the client connected to multiple nodes, a single node will be selected randomly.

## ◆ SetMaxRows()

void ignite::thin::cache::query::SqlFieldsQuery::SetMaxRows | ( | int32_t | maxRows | ) |
| inline

Set maximum number of rows.

Parameters

  maxRows | Max rows.

## ◆ SetPageSize()

void ignite::thin::cache::query::SqlFieldsQuery::SetPageSize | ( | int32_t | pageSize | ) |
| inline

Set page size.

Parameters

  pageSize | Page size.

## ◆ SetPartitions()

void ignite::thin::cache::query::SqlFieldsQuery::SetPartitions | ( | const std::vector< int32_t > & | partitions | ) |
| inline

Set partitions for the query.

The query will be executed only on nodes which are primary for specified partitions.

Parameters

  partitions | Partitions for the query.

## ◆ SetSchema()

void ignite::thin::cache::query::SqlFieldsQuery::SetSchema | ( | const std::string & | schema | ) |
| inline

Set schema name for the query.

If not set, current cache name is used, which means you can omit schema name for tables within the current cache.

Parameters

  schema | Schema. Empty string to unset.

## ◆ SetSql()

void ignite::thin::cache::query::SqlFieldsQuery::SetSql | ( | const std::string & | sql | ) |
| inline

Set SQL string.

Parameters

  sql | SQL string.

## ◆ SetTimeout()

void ignite::thin::cache::query::SqlFieldsQuery::SetTimeout | ( | int64_t | timeout | ) |
| inline

Set query execution timeout in milliseconds.

Parameters

  timeout | Timeout in milliseconds.

## ◆ SetUpdateBatchSize()

void ignite::thin::cache::query::SqlFieldsQuery::SetUpdateBatchSize | ( | int32_t | size | ) |
| inline

Set batch size for update queries.

Parameters

  size | Batch size for update queries.

## ◆ Swap()

void ignite::thin::cache::query::SqlFieldsQuery::Swap | ( | SqlFieldsQuery & | other | ) |
| inline

Efficiently swaps contents with another SqlQuery instance.

Parameters

  other | Other instance.

The documentation for this class was generated from the following file:

- thin-client/include/ignite/thin/cache/query/query_sql_fields.h