Module: Cql::Client
- Defined in:
- lib/cql/client.rb,
lib/cql/client/query_result.rb,
lib/cql/client/column_metadata.rb,
lib/cql/client/result_metadata.rb,
lib/cql/client/synchronous_client.rb,
lib/cql/client/asynchronous_client.rb,
lib/cql/client/synchronous_prepared_statement.rb,
lib/cql/client/asynchronous_prepared_statement.rb
Overview
A CQL client manages connections to one or more Cassandra nodes and you use it run queries, insert and update data.
Client instances are threadsafe.
See Client for the full client API.
Defined Under Namespace
Classes: AsynchronousClient, AsynchronousPreparedStatement, Client, ColumnMetadata, Pipeline, PreparedStatement, QueryResult, ResultMetadata, SynchronousClient, SynchronousPreparedStatement
Constant Summary collapse
- NotConnectedError =
Class.new(ClientError)
- InvalidKeyspaceNameError =
Class.new(ClientError)
Class Method Summary collapse
-
.connect(options = {}) ⇒ Cql::Client::Client
Create a new client and connects to Cassandra.
Instance Method Summary collapse
-
#close ⇒ Object
Disconnect from all nodes.
-
#connect ⇒ Object
Connect to all nodes.
-
#connected? ⇒ true, false
Returns whether or not the client is connected.
-
#execute(cql, consistency = :quorum) ⇒ nil, Cql::Client::QueryResult
Execute a CQL statement.
-
#keyspace ⇒ nil
Returns the name of the current keyspace, or ‘nil` if no keyspace has been set yet.
-
#prepare(cql) ⇒ Cql::Client::PreparedStatement
Returns a prepared statement that can be run over and over again with different values.
-
#use(keyspace) ⇒ nil
Changes keyspace by sending a ‘USE` statement to all connections.
Class Method Details
.connect(options = {}) ⇒ Cql::Client::Client
Create a new client and connects to Cassandra.
61 62 63 |
# File 'lib/cql/client.rb', line 61 def self.connect(={}) SynchronousClient.new(AsynchronousClient.new()).connect end |
Instance Method Details
#close ⇒ Object
Disconnect from all nodes.
|
# File 'lib/cql/client.rb', line 79
|
#connect ⇒ Object
Connect to all nodes.
You must call this method before you call any of the other methods of a client. Calling it again will have no effect.
If ‘:keyspace` was specified when the client was created the current keyspace will also be changed (otherwise the current keyspace will not be set).
|
# File 'lib/cql/client.rb', line 66
|
#connected? ⇒ true, false
Returns whether or not the client is connected.
|
# File 'lib/cql/client.rb', line 85
|
#execute(cql, consistency = :quorum) ⇒ nil, Cql::Client::QueryResult
Execute a CQL statement
|
# File 'lib/cql/client.rb', line 109
|
#keyspace ⇒ nil
Returns the name of the current keyspace, or ‘nil` if no keyspace has been set yet.
|
# File 'lib/cql/client.rb', line 91
|
#prepare(cql) ⇒ Cql::Client::PreparedStatement
Returns a prepared statement that can be run over and over again with different values.
|
# File 'lib/cql/client.rb', line 122
|
#use(keyspace) ⇒ nil
Changes keyspace by sending a ‘USE` statement to all connections.
The the second parameter is meant for internal use only.
|
# File 'lib/cql/client.rb', line 99
|