Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@olavloite
Copy link

Adds ReadOnlyTransaction for the internal Spanner connection API. These transactions can only be used to execute queries. ReadOnlyTransactions support using a read-only staleness mode and timestamp or staleness.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 26, 2019
@olavloite olavloite requested a review from kolea2 July 26, 2019 16:48

@Override
public ResultSet executeQuery(Statement statement, QueryOption... options) {
if (readTimestamp == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we are overriding these methods for the test?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the naming is a little bit confusing in this case, as we have two different ReadOnlyTransactions in this case. The interface that is being implemented is com.google.cloud.spanner.ReadOnlyTransaction, i.e. the read-only transaction of the normal client library, and not the read-only transaction of the connection API. That is done in this test in order to create a simple mock object with some logic to use in the test cases.

The logic in the executeQuery(...) method is intended to make sure the connection API actually uses the correct staleness mode for the underlying read-only transaction (and to return a mock result set).

@olavloite olavloite merged commit 1120eb1 into googleapis:spanner-jdbc Jul 28, 2019
olavloite added a commit to olavloite/google-cloud-java that referenced this pull request Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants