public class CloudSpannerConnection extends AbstractCloudSpannerConnection
| Modifier and Type | Class and Description |
|---|---|
static class |
CloudSpannerConnection.CloudSpannerDatabaseSpecification |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE| Modifier and Type | Method and Description |
|---|---|
void |
addAutoBatchedDdlOperation(String sql) |
void |
clearAutoBatchedDdlOperations() |
int |
clearFinishedDDLOperations()
Clears the asynchronous DDL-operations that have finished.
|
void |
close() |
void |
commit() |
void |
commitPreparedTransaction(String xid)
Commit a previously prepared transaction.
|
CloudSpannerArray |
createArrayOf(String typeName,
Object[] elements) |
CloudSpannerConnection |
createCopyConnection() |
CloudSpannerStatement |
createStatement() |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency) |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
Void |
executeDDL(List<String> inputSql)
Execute one or more DDL-statements on the database and wait for it to finish or return after
syntax check (when running in async mode).
|
List<String> |
getAutoBatchedDdlOperations() |
boolean |
getAutoCommit() |
String |
getClientId() |
static com.google.auth.oauth2.GoogleCredentials |
getCredentialsFromFile(String credentialsPath) |
static com.google.auth.oauth2.GoogleCredentials |
getCredentialsFromOAuthToken(String oauthToken) |
ResultSet |
getDynamicConnectionProperties(CloudSpannerStatement statement) |
ResultSet |
getDynamicConnectionProperty(CloudSpannerStatement statement,
String propertyName) |
com.google.cloud.Timestamp |
getLastCommitTimestamp() |
ResultSet |
getLastCommitTimestamp(CloudSpannerStatement statement) |
Logger |
getLogger() |
CloudSpannerDatabaseMetaData |
getMetaData() |
int |
getNodeCount() |
String |
getProductName() |
com.google.cloud.Timestamp |
getReadTimestamp() |
ResultSet |
getRunningDDLOperations(CloudSpannerStatement statement)
Returns a ResultSet containing all asynchronous DDL-operations started by this connection.
|
static String |
getServiceAccountProjectId(String credentialsPath) |
Integer |
getSimulateMajorVersion() |
Integer |
getSimulateMinorVersion() |
String |
getSimulateProductName() |
Properties |
getSuppliedProperties() |
MetaDataStore.TableKeyMetaData |
getTable(String name) |
CloudSpannerTransaction |
getTransaction() |
int |
getTransactionIsolation() |
Map<String,Class<?>> |
getTypeMap() |
String |
getUrl() |
boolean |
isAllowExtendedMode() |
boolean |
isAsyncDdlOperations() |
boolean |
isAutoBatchDdlOperations() |
boolean |
isBatchReadOnly() |
boolean |
isClosed() |
boolean |
isReadOnly() |
boolean |
isReportDefaultSchemaAsNull() |
boolean |
isUseCustomHost() |
boolean |
isValid(int timeout) |
String |
nativeSQL(String sql) |
CallableStatement |
prepareCall(String sql) |
CloudSpannerPreparedStatement |
prepareStatement(String sql) |
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys) |
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes) |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency) |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
PreparedStatement |
prepareStatement(String sql,
String[] columnNames) |
void |
prepareTransaction(String xid)
Prepare the current transaction by writing the mutations to the XA_TRANSACTIONS table instead
of persisting them in the actual tables.
|
void |
releaseSavepoint(Savepoint savepoint) |
int |
resetDynamicConnectionProperty(String propertyName)
Reset a dynamic connection property to its original value, such as AsyncDdlOperations
|
void |
rollback() |
void |
rollback(Savepoint savepoint) |
void |
rollbackPreparedTransaction(String xid)
Rollback a previously prepared transaction.
|
int |
setAllowExtendedMode(boolean allowExtendedMode) |
int |
setAsyncDdlOperations(boolean asyncDdlOperations) |
int |
setAutoBatchDdlOperations(boolean autoBatchDdlOperations) |
void |
setAutoCommit(boolean autoCommit) |
int |
setBatchReadOnly(boolean batchReadOnly) |
int |
setDynamicConnectionProperty(String propertyName,
String propertyValue)
Set a dynamic connection property, such as AsyncDdlOperations
|
void |
setReadOnly(boolean readOnly) |
int |
setReportDefaultSchemaAsNull(boolean reportDefaultSchemaAsNull) |
Savepoint |
setSavepoint() |
Savepoint |
setSavepoint(String name) |
void |
setSimulateMajorVersion(Integer majorVersion) |
void |
setSimulateMinorVersion(Integer minorVersion) |
void |
setSimulateProductName(String productName) |
void |
setTransactionIsolation(int level) |
void |
setTypeMap(Map<String,Class<?>> map) |
void |
waitForDdlOperations()
Waits for all asynchronous DDL-operations that have been issued by this connection to finish.
|
abort, checkClosed, clearWarnings, createBlob, createClob, createNClob, createSQLXML, createStruct, getCatalog, getClientInfo, getClientInfo, getHoldability, getNetworkTimeout, getSchema, getWarnings, prepareCall, prepareCall, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setSchemaextractColumnType, getClassName, getClassName, getGoogleTypeName, isWrapperFor, unwrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisWrapperFor, unwrappublic static com.google.auth.oauth2.GoogleCredentials getCredentialsFromOAuthToken(String oauthToken)
public static com.google.auth.oauth2.GoogleCredentials getCredentialsFromFile(String credentialsPath) throws IOException
IOExceptionpublic String getSimulateProductName()
public void setSimulateProductName(String productName)
public Integer getSimulateMajorVersion()
public void setSimulateMajorVersion(Integer majorVersion)
public Integer getSimulateMinorVersion()
public void setSimulateMinorVersion(Integer minorVersion)
public Void executeDDL(List<String> inputSql) throws SQLException
inputSql - The DDL-statement(s) to execute. Some statements may end up not being sent to
Cloud Spanner if they contain IF [NOT] EXISTS clauses. The driver will check whether the
condition is met, and only then will it be sent to Cloud Spanner.SQLException - If an error occurs during the execution of the statement.public int clearFinishedDDLOperations()
public void waitForDdlOperations()
throws SQLException
SQLException - If a database exception occurs while waiting for the operations to finishpublic ResultSet getRunningDDLOperations(CloudSpannerStatement statement) throws SQLException
statement - The statement that requested the operationsSQLException - If a database error occurspublic String getProductName()
public CloudSpannerStatement createStatement() throws SQLException
SQLExceptionpublic CloudSpannerPreparedStatement prepareStatement(String sql) throws SQLException
SQLExceptionpublic CallableStatement prepareCall(String sql) throws SQLException
SQLExceptionpublic String nativeSQL(String sql) throws SQLException
SQLExceptionpublic void setAutoCommit(boolean autoCommit)
throws SQLException
SQLExceptionpublic boolean getAutoCommit()
throws SQLException
SQLExceptionpublic void commit()
throws SQLException
SQLExceptionpublic void rollback()
throws SQLException
SQLExceptionpublic CloudSpannerTransaction getTransaction()
public void close()
throws SQLException
SQLExceptionpublic boolean isClosed()
throws SQLException
SQLExceptionpublic CloudSpannerDatabaseMetaData getMetaData() throws SQLException
SQLExceptionpublic void setReadOnly(boolean readOnly)
throws SQLException
SQLExceptionpublic boolean isReadOnly()
throws SQLException
SQLExceptionpublic void setTransactionIsolation(int level)
throws SQLException
SQLExceptionpublic int getTransactionIsolation()
throws SQLException
SQLExceptionpublic Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
SQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
SQLExceptionpublic Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
SQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
SQLExceptionpublic PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
SQLExceptionpublic PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
SQLExceptionpublic PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
SQLExceptionpublic String getUrl()
public String getClientId()
public boolean isValid(int timeout)
throws SQLException
SQLExceptionpublic CloudSpannerArray createArrayOf(String typeName, Object[] elements) throws SQLException
SQLExceptionpublic MetaDataStore.TableKeyMetaData getTable(String name) throws SQLException
SQLExceptionpublic Properties getSuppliedProperties()
public boolean isAllowExtendedMode()
public int setAllowExtendedMode(boolean allowExtendedMode)
public boolean isAsyncDdlOperations()
public int setAsyncDdlOperations(boolean asyncDdlOperations)
public boolean isAutoBatchDdlOperations()
public int setAutoBatchDdlOperations(boolean autoBatchDdlOperations)
public boolean isReportDefaultSchemaAsNull()
public int setReportDefaultSchemaAsNull(boolean reportDefaultSchemaAsNull)
public int setDynamicConnectionProperty(String propertyName, String propertyValue) throws SQLException
propertyName - The name of the dynamic connection propertypropertyValue - The value to setSQLException - Throws SQLException if a database error occurspublic int resetDynamicConnectionProperty(String propertyName) throws SQLException
propertyName - The name of the dynamic connection propertySQLException - Throws SQLException if a database error occurspublic ResultSet getDynamicConnectionProperties(CloudSpannerStatement statement) throws SQLException
SQLExceptionpublic ResultSet getDynamicConnectionProperty(CloudSpannerStatement statement, String propertyName) throws SQLException
SQLExceptionpublic ResultSet getLastCommitTimestamp(CloudSpannerStatement statement) throws SQLException
SQLExceptionpublic com.google.cloud.Timestamp getLastCommitTimestamp()
public com.google.cloud.Timestamp getReadTimestamp()
public CloudSpannerConnection createCopyConnection() throws SQLException
SQLException - If an error occurs while opening the new connectionpublic Logger getLogger()
public Map<String,Class<?>> getTypeMap() throws SQLException
SQLExceptionpublic void setTypeMap(Map<String,Class<?>> map) throws SQLException
SQLExceptionpublic int getNodeCount()
throws SQLException
SQLException - If an exception occurs when trying to get the number of nodespublic void prepareTransaction(String xid) throws SQLException
xid - The id of the prepared transactionSQLException - If an exception occurs while saving the mutations to the database for
later commitpublic void commitPreparedTransaction(String xid) throws SQLException
xid - The id of the prepared transactionSQLException - If an error occurs when writing the mutations to the databasepublic void rollbackPreparedTransaction(String xid) throws SQLException
xid - The id of the prepared transaction to rollbackSQLException - If an error occurs while rolling back the prepared transactionpublic void clearAutoBatchedDdlOperations()
public void addAutoBatchedDdlOperation(String sql)
public boolean isBatchReadOnly()
public int setBatchReadOnly(boolean batchReadOnly)
throws SQLException
SQLExceptionpublic Savepoint setSavepoint() throws SQLException
SQLExceptionpublic Savepoint setSavepoint(String name) throws SQLException
SQLExceptionpublic void rollback(Savepoint savepoint) throws SQLException
SQLExceptionpublic void releaseSavepoint(Savepoint savepoint) throws SQLException
SQLExceptionpublic boolean isUseCustomHost()
Copyright © 2018. All rights reserved.