Google Cloud Spanner C++ Client  1.42.0
A C++ Client Library for Google Cloud Spanner
Classes | Public Member Functions | List of all members
google::cloud::spanner::Connection Class Reference

A connection to a Spanner database instance. More...

#include <google/cloud/spanner/connection.h>

Classes

struct  CommitParams
 Wrap the arguments to Commit(). More...
 
struct  ExecuteBatchDmlParams
 Wrap the arguments to ExecuteBatchDml(). More...
 
struct  ExecutePartitionedDmlParams
 Wrap the arguments to ExecutePartitionedDml(). More...
 
struct  PartitionQueryParams
 Wrap the arguments to PartitionQuery(). More...
 
struct  PartitionReadParams
 Wrap the arguments to PartitionRead(). More...
 
struct  ReadParams
 Wrap the arguments to Read(). More...
 
struct  RollbackParams
 Wrap the arguments to Rollback(). More...
 
struct  SqlParams
 Wrap the arguments to ExecuteQuery(), ExecuteDml(), ProfileQuery(), ProfileDml(), and AnalyzeSql(). More...
 

Public Member Functions

virtual ~Connection ()=default
 
Defines the arguments for each member function.

Applications may define classes derived from Connection, for example, because they want to mock the class.

To avoid breaking all such derived classes when we change the number or type of the arguments to the member functions we define light weight structures to pass the arguments.

virtual Options options ()
 Returns the options used by the Connection. More...
 
virtual RowStream Read (ReadParams)
 Defines the interface for Client::Read() More...
 
virtual StatusOr< std::vector< ReadPartition > > PartitionRead (PartitionReadParams)
 Defines the interface for Client::PartitionRead() More...
 
virtual RowStream ExecuteQuery (SqlParams)
 Defines the interface for Client::ExecuteQuery() More...
 
virtual StatusOr< DmlResultExecuteDml (SqlParams)
 Defines the interface for Client::ExecuteDml() More...
 
virtual ProfileQueryResult ProfileQuery (SqlParams)
 Defines the interface for Client::ProfileQuery() More...
 
virtual StatusOr< ProfileDmlResultProfileDml (SqlParams)
 Defines the interface for Client::ProfileDml() More...
 
virtual StatusOr< ExecutionPlanAnalyzeSql (SqlParams)
 Defines the interface for Client::AnalyzeSql() More...
 
virtual StatusOr< PartitionedDmlResultExecutePartitionedDml (ExecutePartitionedDmlParams)
 Defines the interface for Client::ExecutePartitionedDml() More...
 
virtual StatusOr< std::vector< QueryPartition > > PartitionQuery (PartitionQueryParams)
 Defines the interface for Client::PartitionQuery() More...
 
virtual StatusOr< BatchDmlResultExecuteBatchDml (ExecuteBatchDmlParams)
 Defines the interface for Client::ExecuteBatchDml() More...
 
virtual StatusOr< CommitResultCommit (CommitParams)
 Defines the interface for Client::Commit() More...
 
virtual Status Rollback (RollbackParams)
 Defines the interface for Client::Rollback() More...
 

Detailed Description

A connection to a Spanner database instance.

This interface defines pure-virtual methods for each of the user-facing overload sets in Client. That is, all of Client's Read() overloads will forward to the one pure-virtual Read() method declared in this interface, and similar for Client's other methods. This allows users to inject custom behavior (e.g., with a Google Mock object) in a Client object for use in their own tests.

To create a concrete instance that connects you to a real Spanner database, see MakeConnection().

Definition at line 59 of file connection.h.

Constructor & Destructor Documentation

◆ ~Connection()

virtual google::cloud::spanner::Connection::~Connection ( )
virtualdefault

Member Function Documentation

◆ AnalyzeSql()

virtual StatusOr<ExecutionPlan> google::cloud::spanner::Connection::AnalyzeSql ( SqlParams  )
virtual

Defines the interface for Client::AnalyzeSql()

◆ Commit()

virtual StatusOr<CommitResult> google::cloud::spanner::Connection::Commit ( CommitParams  )
virtual

Defines the interface for Client::Commit()

◆ ExecuteBatchDml()

virtual StatusOr<BatchDmlResult> google::cloud::spanner::Connection::ExecuteBatchDml ( ExecuteBatchDmlParams  )
virtual

Defines the interface for Client::ExecuteBatchDml()

◆ ExecuteDml()

virtual StatusOr<DmlResult> google::cloud::spanner::Connection::ExecuteDml ( SqlParams  )
virtual

Defines the interface for Client::ExecuteDml()

◆ ExecutePartitionedDml()

virtual StatusOr<PartitionedDmlResult> google::cloud::spanner::Connection::ExecutePartitionedDml ( ExecutePartitionedDmlParams  )
virtual

Defines the interface for Client::ExecutePartitionedDml()

◆ ExecuteQuery()

virtual RowStream google::cloud::spanner::Connection::ExecuteQuery ( SqlParams  )
virtual

Defines the interface for Client::ExecuteQuery()

◆ options()

virtual Options google::cloud::spanner::Connection::options ( )
inlinevirtual

Returns the options used by the Connection.

Definition at line 132 of file connection.h.

◆ PartitionQuery()

virtual StatusOr<std::vector<QueryPartition> > google::cloud::spanner::Connection::PartitionQuery ( PartitionQueryParams  )
virtual

Defines the interface for Client::PartitionQuery()

◆ PartitionRead()

virtual StatusOr<std::vector<ReadPartition> > google::cloud::spanner::Connection::PartitionRead ( PartitionReadParams  )
virtual

Defines the interface for Client::PartitionRead()

◆ ProfileDml()

virtual StatusOr<ProfileDmlResult> google::cloud::spanner::Connection::ProfileDml ( SqlParams  )
virtual

Defines the interface for Client::ProfileDml()

◆ ProfileQuery()

virtual ProfileQueryResult google::cloud::spanner::Connection::ProfileQuery ( SqlParams  )
virtual

Defines the interface for Client::ProfileQuery()

◆ Read()

virtual RowStream google::cloud::spanner::Connection::Read ( ReadParams  )
virtual

Defines the interface for Client::Read()

◆ Rollback()

virtual Status google::cloud::spanner::Connection::Rollback ( RollbackParams  )
virtual

Defines the interface for Client::Rollback()