Class: Ilios::Cassandra::Result
- Inherits:
-
Object
- Object
- Ilios::Cassandra::Result
- Includes:
- Enumerable
- Defined in:
- ext/ilios/ilios.c
Instance Method Summary collapse
-
#each ⇒ Cassandra::Result, Enumerator
Yield the row of result into a block.
-
#next_page ⇒ Cassandra::Result?
Loads next page synchronously.
Instance Method Details
#each ⇒ Cassandra::Result, Enumerator
Yield the row of result into a block.
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'ext/ilios/result.c', line 219
static VALUE result_each(VALUE self)
{
CassandraResult *cassandra_result;
CassIterator *iterator;
struct result_each_arg args;
RETURN_ENUMERATOR(self, 0, 0);
GET_RESULT(self, cassandra_result);
iterator = cass_iterator_from_result(cassandra_result->result);
args.cassandra_result = cassandra_result;
args.iterator = iterator;
rb_ensure(result_each_body, (VALUE)&args, result_each_ensure, (VALUE)iterator);
return self;
}
|
#next_page ⇒ Cassandra::Result?
Loads next page synchronously
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'ext/ilios/result.c', line 42
static VALUE result_next_page(VALUE self)
{
CassandraResult *cassandra_result;
CassandraStatement *cassandra_statement;
CassandraSession *cassandra_session;
CassFuture *result_future;
GET_RESULT(self, cassandra_result);
if (cass_result_has_more_pages(cassandra_result->result) == cass_false) {
return Qnil;
}
GET_STATEMENT(cassandra_result->statement_obj, cassandra_statement);
GET_SESSION(cassandra_statement->session_obj, cassandra_session);
// Reuse this result's own executed statement: it is not shared with other
// executions and its previous request has already completed, so setting
// the paging state cannot race with the driver's IO thread.
cass_statement_set_paging_state(cassandra_result->executed_statement, cassandra_result->result);
result_future = nogvl_session_execute(cassandra_session->session, cassandra_result->executed_statement);
cass_result_free(cassandra_result->result);
if (cassandra_result->future) {
cass_future_free(cassandra_result->future);
}
cassandra_result->result = NULL;
cassandra_result->future = result_future;
result_await(cassandra_result);
return self;
}
|