Class: Cql::Client::PreparedStatement

Inherits:
Object
  • Object
show all
Defined in:
lib/cql/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#metadataResultMetadata (readonly)

Returns:



183
184
185
# File 'lib/cql/client.rb', line 183

def 
  @metadata
end

Instance Method Details

#execute(*args) ⇒ nil, Cql::Client::QueryResult

Execute the prepared statement with a list of values to be bound to the statements parameters.

The number of arguments must equal the number of bound parameters. You can also specify options as the last argument, or a symbol as a shortcut for just specifying the consistency.

Because you can specify options, or not, there is an edge case where if the last parameter of your prepared statement is a map, and you forget to specify a value for your map, the options will end up being sent to Cassandra. Most other cases when you specify the wrong number of arguments should result in an ‘ArgumentError` or `TypeError` being raised.

rows (see {Cql::Client::QueryResult}).

Parameters:

  • args (Array)

    the values for the bound parameters. The last argument can also be an options hash or a symbol (as a shortcut for specifying the consistency), see Client#execute for full details.

Returns:

  • (nil, Cql::Client::QueryResult)

    Most statements have no result and return ‘nil`, but `SELECT` statements return an `Enumerable` of

Raises:

  • (ArgumentError)

    raised when number of argument does not match the number of parameters needed to be bound to the statement.

  • (Cql::NotConnectedError)

    raised when the client is not connected

  • (Cql::Io::IoError)

    raised when there is an IO error, for example if the server suddenly closes the connection

  • (Cql::QueryError)

    raised when there is an error on the server side



212
213
# File 'lib/cql/client.rb', line 212

def execute(*args)
end