Class: Ilios::Cassandra::Statement

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

Instance Method Summary collapse

Instance Method Details

#bind(hash) ⇒ Object



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'ext/ilios/statement.c', line 568

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

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

    // Merge into a copy instead of mutating in place: the previous hash may be
    // shared with a frozen (Ractor-shareable) statement or be iterated by an
    // execution on another thread.
    if (NIL_P(cassandra_statement->bound_values)) {
        bound_values = rb_hash_new();
    } else {
        bound_values = rb_hash_dup(cassandra_statement->bound_values);
    }
    RB_OBJ_WRITE(self, &cassandra_statement->bound_values, bound_values);

    ctx.prepared = cassandra_statement->prepared;
    ctx.statement = cassandra_statement->statement;
    ctx.bound_values = bound_values;

    rb_hash_foreach(hash, hash_cb, (VALUE)&ctx);
    return self;
}

#idempotent=(idempotent) ⇒ Object



619
620
621
622
623
624
625
626
627
# File 'ext/ilios/statement.c', line 619

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

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

#page_size=(page_size) ⇒ Object



601
602
603
604
605
606
607
608
609
# File 'ext/ilios/statement.c', line 601

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

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