Class ConnectionProviderTarget
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.common.ConnectionProviderTarget
-
- All Implemented Interfaces:
IDatabaseTarget
public class ConnectionProviderTarget extends java.lang.Object implements IDatabaseTarget
AnIDatabaseTarget
which uses anIConnectionProvider
to obtain a connection which is then closed immediately for each statement. Each run statement is committed before the connection is closed. This target is not intended for use with the ITransactionProvider/ITransaction implementation.
-
-
Constructor Summary
Constructors Constructor Description ConnectionProviderTarget(IConnectionProvider cp)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
runStatement(IDatabaseTranslator translator, java.lang.String ddl)
Run the given DDL statement against the connection managed by the implementation of this interfacevoid
runStatement(IDatabaseTranslator translator, IDatabaseStatement statement)
Run the statement using the resources (e.g.<T> T
runStatement(IDatabaseTranslator translator, IDatabaseSupplier<T> supplier)
Run a statement returning a value of type T.void
runStatementWithInt(IDatabaseTranslator translator, java.lang.String sql, int value)
Convenience method for running a SQL statement requiring a single int parameter
-
-
-
Constructor Detail
-
ConnectionProviderTarget
public ConnectionProviderTarget(IConnectionProvider cp)
Public constructor- Parameters:
cp
- provides connections used for running statements
-
-
Method Detail
-
runStatement
public void runStatement(IDatabaseTranslator translator, java.lang.String ddl)
Description copied from interface:IDatabaseTarget
Run the given DDL statement against the connection managed by the implementation of this interface- Specified by:
runStatement
in interfaceIDatabaseTarget
-
runStatementWithInt
public void runStatementWithInt(IDatabaseTranslator translator, java.lang.String sql, int value)
Description copied from interface:IDatabaseTarget
Convenience method for running a SQL statement requiring a single int parameter- Specified by:
runStatementWithInt
in interfaceIDatabaseTarget
-
runStatement
public void runStatement(IDatabaseTranslator translator, IDatabaseStatement statement)
Description copied from interface:IDatabaseTarget
Run the statement using the resources (e.g. connection) held by the implementation of this interface- Specified by:
runStatement
in interfaceIDatabaseTarget
-
runStatement
public <T> T runStatement(IDatabaseTranslator translator, IDatabaseSupplier<T> supplier)
Description copied from interface:IDatabaseTarget
Run a statement returning a value of type T.- Specified by:
runStatement
in interfaceIDatabaseTarget
- Returns:
-
-