public interface Connection
ScriptellaDriver
.
The implementations are not required to be thread safe.
For most cases AbstractConnection
may be used as a base for driver connection implementation.
NativeConnectionProvider
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection and releases all related resources.
|
void |
commit()
Commits a current transaction (if any).
|
void |
executeQuery(Resource queryContent,
ParametersCallback parametersCallback,
QueryCallback queryCallback)
Executes a query specified by its content.
|
void |
executeScript(Resource scriptContent,
ParametersCallback parametersCallback)
Executes a script specified by its content.
|
DialectIdentifier |
getDialectIdentifier()
This method returns a language dialect identifier for this connection.
|
long |
getExecutedStatementsCount()
This method returns the number of executed statements or 0 if this feature is unsupported.
|
void |
rollback()
Rolls back a current transaction (if any).
|
java.lang.String |
toString() |
DialectIdentifier getDialectIdentifier() throws ProviderException
ProviderException
- if driver failed to determine a language dialect.void executeScript(Resource scriptContent, ParametersCallback parametersCallback) throws ProviderException
scriptContent may be used as a key for caching purposes, i.e.
provider may precompile scripts and use compiled versions for subsequent executions.
Please note that only inline text resources
can be safely cached.
scriptContent
- script content. Cannot be null.parametersCallback
- callback to get parameter values. Cannot be null.ProviderException
- if script execution failed.void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) throws ProviderException
queryContent
- query content. Cannot be null.parametersCallback
- callback to get parameter values. Cannot be null.queryCallback
- callback to call for each result set element produced by this query. Cannot be null.ProviderException
- if query execution failed.executeScript(scriptella.spi.Resource,scriptella.spi.ParametersCallback)
long getExecutedStatementsCount()
If possible the connection should collect statistics about the number of executed statement. It's recommended to provide the most actual execution statistics, i.e. increment internal statements counter during a script or a query execution, so the monitoring tools would be able to track progress.
void commit() throws ProviderException
Throwing an error during commit phase cause rollback
.
ProviderException
- if a problem occured during commit phase.void rollback() throws ProviderException, java.lang.UnsupportedOperationException
ProviderException
- if driver fails to roll back a transaction.java.lang.UnsupportedOperationException
- if transactions are not supportedvoid close() throws ProviderException
ProviderException
- if a critical failure occured.java.lang.String toString()
toString
in class java.lang.Object
Copyright © Copyright 2006-2019 The Scriptella Project Team.