23 #ifndef _IGNITE_CACHE_QUERY_QUERY_SQL 24 #define _IGNITE_CACHE_QUERY_QUERY_SQL 30 #include <ignite/impl/cache/query/query_argument.h> 53 SqlQuery(
const std::string& type,
const std::string& sql) :
58 distributedJoins(false),
72 pageSize(other.pageSize),
74 distributedJoins(other.distributedJoins),
77 args.reserve(other.args.size());
79 typedef std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator Iter;
81 for (Iter i = other.args.begin(); i != other.args.end(); ++i)
82 args.push_back((*i)->Copy());
107 typedef std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator Iter;
109 for (Iter it = args.begin(); it != args.end(); ++it)
122 std::swap(type, other.type);
123 std::swap(sql, other.sql);
124 std::swap(pageSize, other.pageSize);
125 std::swap(loc, other.loc);
126 std::swap(distributedJoins, other.distributedJoins);
127 std::swap(args, other.args);
188 this->pageSize = pageSize;
218 return distributedJoins;
231 distributedJoins = enabled;
246 args.push_back(
new impl::cache::query::QueryArgument<T>(arg));
254 std::vector<impl::cache::query::QueryArgumentBase*>::iterator iter;
255 for (iter = args.begin(); iter != args.end(); ++iter)
273 writer.
WriteInt32(static_cast<int32_t>(args.size()));
275 std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator it;
277 for (it = args.begin(); it != args.end(); ++it)
278 (*it)->Write(writer);
299 bool distributedJoins;
302 std::vector<impl::cache::query::QueryArgumentBase*> args;
308 #endif //_IGNITE_CACHE_QUERY_QUERY_SQL bool IsLocal() const
Get local flag.
Definition: query_sql.h:196
void Write(binary::BinaryRawWriter &writer) const
Write query info to the stream.
Definition: query_sql.h:266
Declares ignite::binary::BinaryRawWriter class.
void SetDistributedJoins(bool enabled)
Specify if distributed joins are enabled for this query.
Definition: query_sql.h:229
void WriteInt32(int32_t val)
Write 32-byte signed integer.
Definition: binary_raw_writer.cpp:72
bool IsDistributedJoins() const
Check if distributed joins are enabled for this query.
Definition: query_sql.h:216
const std::string & GetType() const
Get type name.
Definition: query_sql.h:136
SqlQuery & operator=(const SqlQuery &other)
Assignment operator.
Definition: query_sql.h:90
void ClearArguments()
Remove all added arguments.
Definition: query_sql.h:252
Sql query.
Definition: query_sql.h:44
const std::string & GetSql() const
Get SQL string.
Definition: query_sql.h:156
void WriteString(const char *val)
Write string.
Definition: binary_raw_writer.cpp:152
void SetPageSize(int32_t pageSize)
Set page size.
Definition: query_sql.h:186
void SetLocal(bool loc)
Set local flag.
Definition: query_sql.h:206
Binary raw writer.
Definition: binary_raw_writer.h:55
void SetSql(const std::string &sql)
Set SQL string.
Definition: query_sql.h:166
void SetType(const std::string &type)
Set type name.
Definition: query_sql.h:146
void AddArgument(const T &arg)
Add argument.
Definition: query_sql.h:244
void WriteBool(bool val)
Write bool.
Definition: binary_raw_writer.cpp:42
void Swap(SqlQuery &other)
Efficiently swaps contents with another SqlQuery instance.
Definition: query_sql.h:118
SqlQuery(const SqlQuery &other)
Copy constructor.
Definition: query_sql.h:69
~SqlQuery()
Destructor.
Definition: query_sql.h:105
Apache Ignite API.
Definition: cache.h:48
SqlQuery(const std::string &type, const std::string &sql)
Constructor.
Definition: query_sql.h:53
int32_t GetPageSize() const
Get page size.
Definition: query_sql.h:176