Class: Cql::Model::Query::Statement
- Inherits:
-
Object
- Object
- Cql::Model::Query::Statement
- Defined in:
- lib/cql/model/query/statement.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#consistency(consist) ⇒ String
(also: #using_consistency)
Specify consistency level to use when executing statemnt See www.datastax.com/docs/1.0/dml/data_consistency Defaults to :local_quorum.
-
#execute ⇒ Object
Execute this CQL statement.
-
#initialize(klass, client) ⇒ Statement
constructor
Initialize instance variables common to all statements.
-
#to_s ⇒ String
Build a string representation of this CQL statement, suitable for execution by a CQL client.
Constructor Details
#initialize(klass, client) ⇒ Statement
Initialize instance variables common to all statements
9 10 11 12 13 |
# File 'lib/cql/model/query/statement.rb', line 9 def initialize(klass, client) @klass = klass @client = client || klass.cql_client @consistency = nil end |
Instance Method Details
#consistency(consist) ⇒ String Also known as: using_consistency
Specify consistency level to use when executing statemnt See www.datastax.com/docs/1.0/dml/data_consistency Defaults to :local_quorum
35 36 37 38 39 |
# File 'lib/cql/model/query/statement.rb', line 35 def consistency(consist) raise ArgumentError, "Cannot specify USING CONSISTENCY twice" unless @consistency.nil? @consistency = consist self end |
#execute ⇒ Object
Execute this CQL statement. Return value and parameters vary for each derived class.
25 26 27 |
# File 'lib/cql/model/query/statement.rb', line 25 def execute raise NotImplementedError, "Subclass responsibility" end |
#to_s ⇒ String
Build a string representation of this CQL statement, suitable for execution by a CQL client.
17 18 19 |
# File 'lib/cql/model/query/statement.rb', line 17 def to_s raise NotImplementedError, "Subclass responsibility" end |