Class: Cequel::Metal::Statement Private
- Inherits:
-
Object
- Object
- Cequel::Metal::Statement
- Defined in:
- lib/cequel/metal/statement.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Builder for CQL statements. Contains a CQL string with bind substitutions and a collection of bind variables
Instance Attribute Summary collapse
-
#bind_vars ⇒ Array
readonly
private
Bind variables for CQL string.
Instance Method Summary collapse
-
#append(cql, *bind_vars) ⇒ void
private
Add a CQL fragment with optional bind variables to the end of the statement.
-
#args ⇒ Array
private
This statement as an array of arguments to Keyspace#execute (CQL string followed by bind variables).
-
#cql ⇒ String
private
CQL statement.
-
#initialize ⇒ Statement
constructor
private
A new instance of Statement.
-
#prepend(cql, *bind_vars) ⇒ void
private
Add a CQL fragment with optional bind variables to the beginning of the statement.
Constructor Details
#initialize ⇒ Statement
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Statement.
14 15 16 |
# File 'lib/cequel/metal/statement.rb', line 14 def initialize @cql, @bind_vars = [], [] end |
Instance Attribute Details
#bind_vars ⇒ Array (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns bind variables for CQL string.
12 13 14 |
# File 'lib/cequel/metal/statement.rb', line 12 def bind_vars @bind_vars end |
Instance Method Details
#append(cql, *bind_vars) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Add a CQL fragment with optional bind variables to the end of the statement
45 46 47 48 49 |
# File 'lib/cequel/metal/statement.rb', line 45 def append(cql, *bind_vars) @cql << cql @bind_vars.concat(bind_vars) self end |
#args ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns this statement as an array of arguments to Keyspace#execute (CQL string followed by bind variables).
55 56 57 |
# File 'lib/cequel/metal/statement.rb', line 55 def args [cql, *bind_vars] end |
#cql ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns CQL statement.
21 22 23 |
# File 'lib/cequel/metal/statement.rb', line 21 def cql @cql.join end |
#prepend(cql, *bind_vars) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Add a CQL fragment with optional bind variables to the beginning of the statement
32 33 34 35 |
# File 'lib/cequel/metal/statement.rb', line 32 def prepend(cql, *bind_vars) @cql.unshift(cql) @bind_vars.unshift(*bind_vars) end |