Class BackendConnection (0.6.1)

publicclass BackendConnection

This class emulates a backend PostgreSQL connection. Statements are buffered in memory until a flush/sync is received. This makes it possible to batch multiple statements together before sending these to Cloud Spanner. This class also keeps track of the transaction status of the connection.

Inheritance

java.lang.Object > BackendConnection

Static Fields

TRANSACTION_ABORTED_ERROR

publicstaticfinalStringTRANSACTION_ABORTED_ERROR
Field Value
Type Description

Methods

execute(AbstractStatementParser.ParsedStatement parsedStatement, Statement statement)

publicFuture<StatementResult>execute(AbstractStatementParser.ParsedStatementparsedStatement,Statementstatement)

Buffers the given statement for execution on the backend connection when the next flush/sync message is received. The returned future will contain the result of the statement when execution has finished.

Parameters
Name Description
parsedStatement ParsedStatement
statement com.google.cloud.spanner.Statement
Returns
Type Description

executeCopy(AbstractStatementParser.ParsedStatement parsedStatement, Statement statement, CopyDataReceiver copyDataReceiver, MutationWriter mutationWriter, ExecutorService executor)

publicFuture<StatementResult>executeCopy(AbstractStatementParser.ParsedStatementparsedStatement,Statementstatement,CopyDataReceivercopyDataReceiver,MutationWritermutationWriter,ExecutorServiceexecutor)

Buffers the given COPY operation for execution on the backend connection when the next flush/sync message is received. The returned future will contain the result of the COPY operation when execution has finished.

Parameters
Name Description
parsedStatement ParsedStatement
statement com.google.cloud.spanner.Statement
copyDataReceiver CopyDataReceiver
mutationWriter MutationWriter
executor ExecutorService
Returns
Type Description

executeCopyOut(AbstractStatementParser.ParsedStatement parsedStatement, Statement statement)

publicFuture<StatementResult>executeCopyOut(AbstractStatementParser.ParsedStatementparsedStatement,Statementstatement)
Parameters
Name Description
parsedStatement ParsedStatement
statement com.google.cloud.spanner.Statement
Returns
Type Description

getConnectionState()

publicBackendConnection.ConnectionStategetConnectionState()

Returns the current connection state.

Returns
Type Description

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.