Class Connection (2.16.0)

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().

Functions

virtual options()

Returns the options used by the Connection.

Returns
Type Description
Options

virtual Read(ReadParams)

Defines the interface for Client::Read()

Parameter
Name Description
ReadParams
Returns
Type Description
RowStream

virtual PartitionRead(PartitionReadParams)

Defines the interface for Client::PartitionRead()

Parameter
Name Description
PartitionReadParams
Returns
Type Description
StatusOr< std::vector< ReadPartition > >

virtual ExecuteQuery(SqlParams)

Defines the interface for Client::ExecuteQuery()

Parameter
Name Description
SqlParams
Returns
Type Description
RowStream

virtual ExecuteDml(SqlParams)

Defines the interface for Client::ExecuteDml()

Parameter
Name Description
SqlParams
Returns
Type Description
StatusOr< DmlResult >

virtual ProfileQuery(SqlParams)

Defines the interface for Client::ProfileQuery()

Parameter
Name Description
SqlParams
Returns
Type Description
ProfileQueryResult

virtual ProfileDml(SqlParams)

Defines the interface for Client::ProfileDml()

Parameter
Name Description
SqlParams
Returns
Type Description
StatusOr< ProfileDmlResult >

virtual AnalyzeSql(SqlParams)

Defines the interface for Client::AnalyzeSql()

Parameter
Name Description
SqlParams
Returns
Type Description
StatusOr< ExecutionPlan >

virtual ExecutePartitionedDml(ExecutePartitionedDmlParams)

Defines the interface for Client::ExecutePartitionedDml()

Parameter
Name Description
ExecutePartitionedDmlParams
Returns
Type Description
StatusOr< PartitionedDmlResult >

virtual PartitionQuery(PartitionQueryParams)

Defines the interface for Client::PartitionQuery()

Parameter
Name Description
PartitionQueryParams
Returns
Type Description
StatusOr< std::vector< QueryPartition > >

virtual ExecuteBatchDml(ExecuteBatchDmlParams)

Defines the interface for Client::ExecuteBatchDml()

Parameter
Name Description
ExecuteBatchDmlParams
Returns
Type Description
StatusOr< BatchDmlResult >

virtual Commit(CommitParams)

Defines the interface for Client::Commit()

Parameter
Name Description
CommitParams
Returns
Type Description
StatusOr< CommitResult >

virtual Rollback(RollbackParams)

Defines the interface for Client::Rollback()

Parameter
Name Description
RollbackParams
Returns
Type Description
Status