struct CassSession
A session object is used to execute queries and maintains cluster state through the control connection. The control connection is used to auto-discover nodes and monitor cluster changes (topology and schema). Each session also maintains multiple pools of connections to cluster nodes which are used to query the cluster.
Instances of the session object are thread-safe to execute queries.
Functions
CassSession *
cass_session_new
( )Creates a new session.
void
cass_session_free
( session )Frees a session instance. If the session is still connected it will be synchronously closed before being deallocated.
Important: Do not free a session in a future callback. Freeing a session in a future callback will cause a deadlock.
CassFuture *
cass_session_connect
( session, cluster )Connects a session.
CassFuture *
cass_session_connect_keyspace
( session, cluster, keyspace )Connects a session and sets the keyspace.
CassFuture *
cass_session_connect_keyspace_n
( session, cluster, keyspace, keyspace_length )Same as CassSession::cass_session_connect_keyspace
, but with lengths for string parameters.
CassFuture *
cass_session_close
( session )Closes the session instance, outputs a close future which can be used to determine when the session has been terminated. This allows in-flight requests to finish.
CassFuture *
cass_session_prepare
( session, query )Create a prepared statement.
CassFuture *
cass_session_prepare_n
( session, query, query_length )Same as CassSession::cass_session_prepare
, but with lengths for string parameters.
CassFuture *
cass_session_execute
( session, statement )Execute a query or bound statement.
CassFuture *
cass_session_execute_batch
( session, batch )Execute a batch statement.
Requires Cassandra: 2.0+
const CassSchemaMeta *
cass_session_get_schema_meta
( session )Gets a snapshot of this session’s schema metadata. The returned snapshot of the schema metadata is not updated. This function must be called again to retrieve any schema changes since the previous call.
void
cass_session_get_metrics
( session, output )Gets a copy of this session’s performance/diagnostic metrics.