Package com.google.cloud.spanner.jdbc
Interface CloudSpannerJdbcStatement
- All Superinterfaces:
AutoCloseable
,Statement
,Wrapper
This interface is implemented by
Statement
s that are created on Cloud Spanner JDBC
connections.-
Field Summary
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
Method Summary
Modifier and TypeMethodDescriptionpartitionQuery
(String query, com.google.cloud.spanner.PartitionOptions partitionOptions, com.google.cloud.spanner.Options.QueryOption... options) Partitions the given query, so it can be executed in parallel.runPartition
(String encodedPartitionId) Executes the given partition of a query.runPartitionedQuery
(String query, com.google.cloud.spanner.PartitionOptions partitionOptions, com.google.cloud.spanner.Options.QueryOption... options) Executes the given query as a partitioned query.Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Method Details
-
partitionQuery
ResultSet partitionQuery(String query, com.google.cloud.spanner.PartitionOptions partitionOptions, com.google.cloud.spanner.Options.QueryOption... options) throws SQLException Partitions the given query, so it can be executed in parallel. This method returns aResultSet
with a string-representation of the partitions that were created. These strings can be used to execute a partition either on this connection or an any other connection (on this host or an any other host) by calling the methodrunPartition(String)
. This method will automatically enable data boost for the query ifCloudSpannerJdbcConnection.isDataBoostEnabled()
returns true.- Throws:
SQLException
-
runPartition
Executes the given partition of a query. The encodedPartitionId should be a string that was returned bypartitionQuery(String, PartitionOptions, QueryOption...)
.- Throws:
SQLException
-
runPartitionedQuery
CloudSpannerJdbcPartitionedQueryResultSet runPartitionedQuery(String query, com.google.cloud.spanner.PartitionOptions partitionOptions, com.google.cloud.spanner.Options.QueryOption... options) throws SQLException Executes the given query as a partitioned query. The query will first be partitioned using thepartitionQuery(String, PartitionOptions, QueryOption...)
method. Each of the partitions will then be executed in the background, and the results will be merged into a single result set.This method will use
CloudSpannerJdbcConnection.getMaxPartitionedParallelism()
threads to execute the partitioned query. Set this variable to a higher/lower value to increase/decrease the degree of parallelism used for execution.- Throws:
SQLException
-