Class: Ilios::Cassandra::Statement

Inherits:
Object
  • Object
show all
Defined in:
ext/ilios/ilios.c

Instance Method Summary collapse

Instance Method Details

#bind(hash) ⇒ Cassandra::Statement

Binds a specified column value to a query. A hash object should be given with column name as key.

Parameters:

  • hash (Hash)

    A hash object to bind.

Returns:

Raises:

  • (RangeError)

    If an invalid range of values was given.

  • (TypeError)

    If an invalid type of values was given.

  • (Cassandra::StatementError)

    If an invalid column name was given.



161
162
163
164
165
166
167
168
169
170
# File 'ext/ilios/statement.c', line 161

static VALUE statement_bind(VALUE self, VALUE hash)
{
    CassandraStatement *cassandra_statement;

    Check_Type(hash, T_HASH);
    TypedData_Get_Struct(self, CassandraStatement, &cassandra_statement_data_type, cassandra_statement);

    rb_hash_foreach(hash, hash_cb, (VALUE)cassandra_statement);
    return self;
}

#idempotent=(idempotent) ⇒ Cassandra::Statement

Sets whether the statement is idempotent. Idempotent statements are able to be automatically retried after timeouts/errors and can be speculatively executed. The default is false.

Parameters:

  • idempotent (Boolean)

    Whether the statement is idempotent.

Returns:



195
196
197
198
199
200
201
202
# File 'ext/ilios/statement.c', line 195

static VALUE statement_idempotent(VALUE self, VALUE idempotent)
{
    CassandraStatement *cassandra_statement;

    GET_STATEMENT(self, cassandra_statement);
    cass_statement_set_is_idempotent(cassandra_statement->statement, RTEST(idempotent) ? cass_true : cass_false);
    return self;
}

#page_size=(page_size) ⇒ Cassandra::Statement

Sets the statement’s page size. The default is 10000.

Parameters:

  • page_size (Integer)

    A page size.

Returns:



178
179
180
181
182
183
184
185
# File 'ext/ilios/statement.c', line 178

static VALUE statement_page_size(VALUE self, VALUE page_size)
{
    CassandraStatement *cassandra_statement;

    GET_STATEMENT(self, cassandra_statement);
    cass_statement_set_paging_size(cassandra_statement->statement, NUM2INT(page_size));
    return self;
}