Class: Cassandra::Statements::Batch
- Inherits:
-
Object
- Object
- Cassandra::Statements::Batch
- Includes:
- Cassandra::Statement
- Defined in:
- lib/cassandra/statements/batch.rb
Overview
Batch statement groups several Cassandra::Statement. There are several types of Batch statements available:
Instance Method Summary collapse
-
#add(statement, args = nil) ⇒ self
Adds a statement to this batch.
-
#cql ⇒ nil
A batch statement doesn't really have any cql of its own as it is composed of multiple different statements.
-
#inspect ⇒ String
A CLI-friendly batch statement representation.
-
#type ⇒ Symbol
One of
:logged
,:unlogged
or:counter
.
Instance Method Details
#add(statement, args = nil) ⇒ self
Positional arguments for simple statements are only supported starting with Apache Cassandra 2.0 and above.
Named arguments for simple statements are only supported starting with Apache Cassandra 2.1 and above.
Adds a statement to this batch.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/cassandra/statements/batch.rb', line 74 def add(statement, args = nil) args ||= EMPTY_LIST case statement when String @statements << Simple.new(statement, args) when Prepared @statements << statement.bind(args) when Bound, Simple @statements << statement else raise ::ArgumentError, "a batch can only consist of simple or prepared statements, #{statement.inspect} given" end self end |
#cql ⇒ nil
A batch statement doesn't really have any cql of its own as it is composed of multiple different statements
93 94 95 |
# File 'lib/cassandra/statements/batch.rb', line 93 def cql nil end |
#inspect ⇒ String
Returns a CLI-friendly batch statement representation.
102 103 104 |
# File 'lib/cassandra/statements/batch.rb', line 102 def inspect "#<#{self.class.name}:0x#{self.object_id.to_s(16)} @type=#{type.inspect}>" end |
#type ⇒ Symbol
Returns one of :logged
, :unlogged
or :counter
.
98 99 |
# File 'lib/cassandra/statements/batch.rb', line 98 def type end |