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
75
76
77
78
79
80
81
|
# 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;
CassError error_code;
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);
nogvl_future_wait(result_future);
error_code = cass_future_error_code(result_future);
if (error_code != CASS_OK) {
cass_future_free(result_future);
rb_raise(eExecutionError, "Unable to wait executing: %s", cass_error_desc(error_code));
}
cass_result_free(cassandra_result->result);
if (cassandra_result->future) {
cass_future_free(cassandra_result->future);
}
cassandra_result->result = cass_future_get_result(result_future);
cassandra_result->future = result_future;
return self;
}
|