![]() |
Hazelcast C++ Client
Hazelcast C++ Client Library
|
SQL query result. More...
#include <sql_result.h>
Classes | |
class | page_iterator |
Public Member Functions | |
virtual | ~sql_result () |
The destructor closes the result if it were open. | |
bool | row_set () const |
Return whether this result has rows to iterate using the iterator() method. | |
const sql_row_metadata & | row_metadata () const |
Gets the row metadata. More... | |
int64_t | update_count () const |
Returns the number of rows updated by the statement or -1 if this result is a row set. More... | |
boost::future< void > | close () |
Release the resources associated with the query result. More... | |
page_iterator | iterator () |
Returns an iterator over the result pages. More... | |
Friends | |
class | sql_service |
SQL query result.
Depending on the statement type it represents a pages of rows or an update count.
Code example:
auto result = hz.get_sql().execute("SELECT * FROM person"); for (auto itr = result.iterator(); itr.has_next();) { auto page = itr.next().get(); for (auto const &row : page->rows()) { // Process the row. } }
auto updated = hz.get_sql().execute("UPDATE ...").get().update_count();
You don't need to call close() in this case.
Definition at line 64 of file sql_result.h.
boost::future< void > hazelcast::client::sql::sql_result::close | ( | ) |
Release the resources associated with the query result.
The query engine delivers the rows asynchronously. The query may become inactive even before all rows are consumed. The invocation of this command will cancel the execution of the query on all members if the query is still active. Otherwise it is no-op. For a result with an update count it is always no-op.
Definition at line 672 of file sql.cpp.
sql_result::page_iterator hazelcast::client::sql::sql_result::iterator | ( | ) |
Returns an iterator over the result pages.
The iterator may be requested only once.
exception::illegal_state | if the iterator is requested more than once or if this result does not have any pages. |
Definition at line 640 of file sql.cpp.
const sql_row_metadata & hazelcast::client::sql::sql_result::row_metadata | ( | ) | const |
Gets the row metadata.
illegal_state_exception | if this result doesn't have rows, but only an update count |
int64_t hazelcast::client::sql::sql_result::update_count | ( | ) | const |