Package com.google.cloud.spanner.jdbc
Interface CloudSpannerJdbcPreparedStatement
- All Superinterfaces:
AutoCloseable,PreparedStatement,Statement,Wrapper
This interface is implemented by
PreparedStatements 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(com.google.cloud.spanner.PartitionOptions partitionOptions, com.google.cloud.spanner.Options.QueryOption... options) Partitions this query, so it can be executed in parallel.Executes the given partition of a query.runPartitionedQuery(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.PreparedStatement
addBatch, clearParameters, execute, executeLargeUpdate, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURLMethods 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, setQueryTimeoutMethods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Method Details
-
partitionQuery
ResultSet partitionQuery(com.google.cloud.spanner.PartitionOptions partitionOptions, com.google.cloud.spanner.Options.QueryOption... options) throws SQLException Partitions this query, so it can be executed in parallel. This method returns aResultSetwith 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(). 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 partition that should be executed must be set as a string parameter on thisPreparedStatementusingPreparedStatement.setString(int, String). The value should be a string that was returned bypartitionQuery(PartitionOptions, QueryOption...).- Throws:
SQLException
-
runPartitionedQuery
CloudSpannerJdbcPartitionedQueryResultSet runPartitionedQuery(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(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
-