Skip to content

Conversation

olavloite
Copy link
Collaborator

Adds an Execute function for SpannerLib that can be used to execute any type of SQL statement. The return type is always a Rows object. The Rows object is empty for DDL statements, it only contains ResultSetStats for DML statements without a THEN RETURN clause, and it contains actual row data for queries and DML statements with a THEN RETURN clause.

The Execute function can also be used to execute client-side SQL statements, like BEGIN, COMMIT, SET, SHOW, etc.

@olavloite olavloite requested a review from a team as a code owner September 14, 2025 07:05
@olavloite olavloite force-pushed the spanner-lib-execute branch 6 times, most recently from 432bc9c to 622d2d8 Compare September 14, 2025 09:59
Adds an Execute function for SpannerLib that can be used to execute any type
of SQL statement. The return type is always a Rows object. The Rows object
is empty for DDL statements, it only contains ResultSetStats for DML statements
without a THEN RETURN clause, and it contains actual row data for queries and
DML statements with a THEN RETURN clause.

The Execute function can also be used to execute client-side SQL statements,
like BEGIN, COMMIT, SET, SHOW, etc.
Copy link
Contributor

@bhatt4982 bhatt4982 left a comment

Choose a reason for hiding this comment

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

LGTM...

* chore: add transaction support for SpannerLib

* chore: add ExecuteBatch to SpannerLib (#531)

* chore: add ExecuteBatch to SpannerLib

Adds an ExecuteBatch function to SpannerLib that supports executing DML or DDL
statements as a single batch. The function accepts an ExecuteBatchDml request
for both types of batches. The type of batch that is actually being executed
is determined based on the statements in the batch. Mixing DML and DDL in the
same batch is not supported. Queries are also not supported in batches.

* chore: add WriteMutations function for SpannerLib (#532)

Adds a WriteMutations function for SpannerLib. This function can be used
to write mutations to Spanner in two ways:
1. In a transaction: The mutations are buffered in the current read/write transaction.
   The returned message is empty.
2. Outside a transaction: The mutations are written to Spanner directly in a new read/write
   transaction. The returned message contains the CommitResponse.
@olavloite olavloite merged commit fbd70b9 into java-wrapper Sep 20, 2025
20 checks passed
@olavloite olavloite deleted the spanner-lib-execute branch September 20, 2025 13:35
olavloite added a commit that referenced this pull request Sep 20, 2025
* chore: add Java wrapper for SpannerLib

Adds a Java wrapper for SpannerLib and some simple tests for this wrapper.

* chore: add Execute function for SpannerLib (#529)

* chore: add Execute function for SpannerLib

Adds an Execute function for SpannerLib that can be used to execute any type
of SQL statement. The return type is always a Rows object. The Rows object
is empty for DDL statements, it only contains ResultSetStats for DML statements
without a THEN RETURN clause, and it contains actual row data for queries and
DML statements with a THEN RETURN clause.

The Execute function can also be used to execute client-side SQL statements,
like BEGIN, COMMIT, SET, SHOW, etc.

* chore: add transaction support for SpannerLib (#530)

* chore: add transaction support for SpannerLib

* chore: add ExecuteBatch to SpannerLib (#531)

* chore: add ExecuteBatch to SpannerLib

Adds an ExecuteBatch function to SpannerLib that supports executing DML or DDL
statements as a single batch. The function accepts an ExecuteBatchDml request
for both types of batches. The type of batch that is actually being executed
is determined based on the statements in the batch. Mixing DML and DDL in the
same batch is not supported. Queries are also not supported in batches.

* chore: add WriteMutations function for SpannerLib (#532)

Adds a WriteMutations function for SpannerLib. This function can be used
to write mutations to Spanner in two ways:
1. In a transaction: The mutations are buffered in the current read/write transaction.
   The returned message is empty.
2. Outside a transaction: The mutations are written to Spanner directly in a new read/write
   transaction. The returned message contains the CommitResponse.
bhatt4982 pushed a commit that referenced this pull request Sep 20, 2025
…526)

* chore: add CreatePool and CreateConnection functions for SpannerLib

Creates a spannerlib module and adds functions for CreatePool and CreateConnection.

* chore: add Java wrapper for SpannerLib (#527)

* chore: add Java wrapper for SpannerLib

Adds a Java wrapper for SpannerLib and some simple tests for this wrapper.

* chore: add Execute function for SpannerLib (#529)

* chore: add Execute function for SpannerLib

Adds an Execute function for SpannerLib that can be used to execute any type
of SQL statement. The return type is always a Rows object. The Rows object
is empty for DDL statements, it only contains ResultSetStats for DML statements
without a THEN RETURN clause, and it contains actual row data for queries and
DML statements with a THEN RETURN clause.

The Execute function can also be used to execute client-side SQL statements,
like BEGIN, COMMIT, SET, SHOW, etc.

* chore: add transaction support for SpannerLib (#530)

* chore: add transaction support for SpannerLib

* chore: add ExecuteBatch to SpannerLib (#531)

* chore: add ExecuteBatch to SpannerLib

Adds an ExecuteBatch function to SpannerLib that supports executing DML or DDL
statements as a single batch. The function accepts an ExecuteBatchDml request
for both types of batches. The type of batch that is actually being executed
is determined based on the statements in the batch. Mixing DML and DDL in the
same batch is not supported. Queries are also not supported in batches.

* chore: add WriteMutations function for SpannerLib (#532)

Adds a WriteMutations function for SpannerLib. This function can be used
to write mutations to Spanner in two ways:
1. In a transaction: The mutations are buffered in the current read/write transaction.
   The returned message is empty.
2. Outside a transaction: The mutations are written to Spanner directly in a new read/write
   transaction. The returned message contains the CommitResponse.

* fix: check for error after calling Next()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants