Class EmbeddedRelationalConnection
java.lang.Object
com.apple.foundationdb.relational.recordlayer.EmbeddedRelationalConnection
- All Implemented Interfaces:
com.apple.foundationdb.relational.api.RelationalConnection,AutoCloseable,Connection,Wrapper
@API(EXPERIMENTAL)
public class EmbeddedRelationalConnection
extends Object
implements com.apple.foundationdb.relational.api.RelationalConnection
Implementation of
RelationalConnection for connecting to a database in Relational when running as an embedded library.
It can itself function in 2 modes:
- Default: The transaction is not supplied to the connection. Its start and end is guided by the JDBC
specification given the state of
autoCommit - With External transaction: In this scenario, an already opened
Transactionis supplied to the connection to be used to execute all statements and procedure. For consumer perspective, this is equivalent toautoCommitbeing set totruesince theConnection.commit()andConnection.rollback()wont be applicable. However, all statements run within the external transaction. For internal usage, the consumer should checkcanCommit()to see if they are allowed to manage a transaction.
-
Field Summary
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Constructor Summary
ConstructorsConstructorDescriptionEmbeddedRelationalConnection(AbstractDatabase frl, StoreCatalog backingCatalog, Transaction transaction, com.apple.foundationdb.relational.api.Options options) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcommit()createArrayOf(String typeName, Object[] elements) com.apple.foundationdb.relational.api.fluentsql.expression.ExpressionFactoryvoidcom.apple.foundationdb.relational.api.RelationalStatementcom.apple.foundationdb.relational.api.fluentsql.statement.StatementBuilderFactorycreateStruct(String typeName, Object[] attributes) booleancom.apple.foundationdb.relational.api.RelationalDatabaseMetaDatacom.apple.foundationdb.relational.api.OptionsgetPath()com.apple.foundationdb.relational.api.metadata.SchemaTemplateReturns theTransactionobject if there is one active.intbooleanisClosed()com.apple.foundationdb.relational.api.RelationalPreparedStatementprepareStatement(String sql) voidrollback()voidsetAutoCommit(boolean autoCommit) voidvoidsetReadOnly(boolean readOnly) voidvoidsetTransactionIsolation(int level) <T> TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValidMethods inherited from interface com.apple.foundationdb.relational.api.RelationalConnection
abort, clearWarnings, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, getCatalog, getClientInfo, getClientInfo, getHoldability, getNetworkTimeout, getTypeMap, isReadOnly, isValid, isWrapperFor, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setSavepoint, setSavepoint, setTypeMap
-
Constructor Details
-
EmbeddedRelationalConnection
public EmbeddedRelationalConnection(@Nonnull AbstractDatabase frl, @Nonnull StoreCatalog backingCatalog, @Nullable Transaction transaction, @Nonnull com.apple.foundationdb.relational.api.Options options) throws com.apple.foundationdb.relational.api.exceptions.InternalErrorException - Throws:
com.apple.foundationdb.relational.api.exceptions.InternalErrorException
-
-
Method Details
-
createStatement
public com.apple.foundationdb.relational.api.RelationalStatement createStatement() throws SQLException- Specified by:
createStatementin interfaceConnection- Specified by:
createStatementin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Throws:
SQLException
-
prepareStatement
public com.apple.foundationdb.relational.api.RelationalPreparedStatement prepareStatement(String sql) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Specified by:
prepareStatementin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnlyin interfaceConnection- Specified by:
setReadOnlyin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommitin interfaceConnection- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommitin interfaceConnection- Throws:
SQLException
-
commit
- Specified by:
commitin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
setSchema
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
getSchemaTemplate
@Nonnull public com.apple.foundationdb.relational.api.metadata.SchemaTemplate getSchemaTemplate() throws com.apple.foundationdb.relational.api.exceptions.RelationalException- Throws:
com.apple.foundationdb.relational.api.exceptions.RelationalException
-
getMetricCollector
-
getSchema
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceConnection- Throws:
SQLException
-
getMetaData
@Nonnull public com.apple.foundationdb.relational.api.RelationalDatabaseMetaData getMetaData() throws SQLException- Specified by:
getMetaDatain interfaceConnection- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
getTransactionIsolation
- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
getWarnings
- Specified by:
getWarningsin interfaceConnection- Specified by:
getWarningsin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Throws:
SQLException
-
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createStruct
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getOptions
@Nonnull public com.apple.foundationdb.relational.api.Options getOptions()- Specified by:
getOptionsin interfacecom.apple.foundationdb.relational.api.RelationalConnection
-
setOption
public void setOption(com.apple.foundationdb.relational.api.Options.Name name, Object value) throws SQLException - Specified by:
setOptionin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Throws:
SQLException
-
getPath
- Specified by:
getPathin interfacecom.apple.foundationdb.relational.api.RelationalConnection
-
getBackingCatalog
-
getTransaction
@Nonnull public Transaction getTransaction() throws com.apple.foundationdb.relational.api.exceptions.RelationalExceptionReturns theTransactionobject if there is one active.- Returns:
- the current transaction.
- Throws:
com.apple.foundationdb.relational.api.exceptions.RelationalException- if there is no active transaction.
-
getRecordLayerDatabase
-
createNewTransaction
public void createNewTransaction() throws com.apple.foundationdb.relational.api.exceptions.RelationalException, SQLException- Throws:
com.apple.foundationdb.relational.api.exceptions.RelationalExceptionSQLException
-
getExecuteProperties
-
unwrap
- Specified by:
unwrapin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
createStatementBuilderFactory
@Nonnull public com.apple.foundationdb.relational.api.fluentsql.statement.StatementBuilderFactory createStatementBuilderFactory() throws SQLException- Specified by:
createStatementBuilderFactoryin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Throws:
SQLException
-
createExpressionBuilderFactory
@Nonnull public com.apple.foundationdb.relational.api.fluentsql.expression.ExpressionFactory createExpressionBuilderFactory() throws SQLException- Specified by:
createExpressionBuilderFactoryin interfacecom.apple.foundationdb.relational.api.RelationalConnection- Throws:
SQLException
-