public class JdbcConnection extends AbstractConnection implements NativeConnectionProvider
AbstractConnection.StatementCounter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTOCOMMIT_KEY |
static java.lang.String |
AUTOCOMMIT_SIZE_KEY |
protected int |
autocommitSize |
static java.lang.String |
FLUSH_BEFORE_QUERY |
protected boolean |
flushBeforeQuery |
protected boolean |
keepformat |
static java.lang.String |
KEEPFORMAT_KEY |
protected java.lang.String |
separator |
protected boolean |
separatorSingleLine |
static java.lang.String |
STATEMENT_BATCH_SIZE |
static java.lang.String |
STATEMENT_CACHE_KEY |
static java.lang.String |
STATEMENT_FETCH_SIZE |
static java.lang.String |
STATEMENT_SEPARATOR_KEY |
static java.lang.String |
STATEMENT_SEPARATOR_SINGLELINE_KEY |
protected int |
statementBatchSize |
protected int |
statementCacheSize |
protected int |
statementFetchSize |
static java.lang.String |
TRANSACTION_ISOLATION_KEY |
static java.lang.String |
TRANSACTION_ISOLATION_READ_COMMITTED |
static java.lang.String |
TRANSACTION_ISOLATION_READ_UNCOMMITTED |
static java.lang.String |
TRANSACTION_ISOLATION_REPEATABLE_READ |
static java.lang.String |
TRANSACTION_ISOLATION_SERIALIZABLE |
counter
Constructor and Description |
---|
JdbcConnection(java.sql.Connection con,
ConnectionParameters parameters) |
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.
|
void |
flush() |
java.sql.Connection |
getNativeConnection()
Returns the native connection which is wrapped by this object or null if this information is not
available.
|
protected void |
init(ConnectionParameters parameters)
Called in constructor
|
protected void |
initDialectIdentifier()
Initializes dialect identifier for connection.
|
protected scriptella.jdbc.StatementCache |
newStatementCache()
Creates an instance of statement cache.
|
void |
rollback()
Rolls back a current transaction (if any).
|
java.lang.String |
toString() |
getDialectIdentifier, getExecutedStatementsCount, isReadonly, setDialectIdentifier
public static final java.lang.String STATEMENT_CACHE_KEY
public static final java.lang.String STATEMENT_SEPARATOR_KEY
public static final java.lang.String STATEMENT_SEPARATOR_SINGLELINE_KEY
public static final java.lang.String STATEMENT_BATCH_SIZE
public static final java.lang.String STATEMENT_FETCH_SIZE
public static final java.lang.String KEEPFORMAT_KEY
public static final java.lang.String AUTOCOMMIT_KEY
public static final java.lang.String AUTOCOMMIT_SIZE_KEY
public static final java.lang.String FLUSH_BEFORE_QUERY
public static final java.lang.String TRANSACTION_ISOLATION_KEY
public static final java.lang.String TRANSACTION_ISOLATION_READ_UNCOMMITTED
public static final java.lang.String TRANSACTION_ISOLATION_READ_COMMITTED
public static final java.lang.String TRANSACTION_ISOLATION_REPEATABLE_READ
public static final java.lang.String TRANSACTION_ISOLATION_SERIALIZABLE
protected int statementCacheSize
protected int statementBatchSize
protected int statementFetchSize
protected boolean flushBeforeQuery
protected java.lang.String separator
protected boolean separatorSingleLine
protected boolean keepformat
protected int autocommitSize
public JdbcConnection(java.sql.Connection con, ConnectionParameters parameters)
protected void init(ConnectionParameters parameters)
parameters
- connection parameters.protected void initDialectIdentifier()
DialectIdentifier.NULL_DIALECT
is used.
May be overriden by subclasses.
public void executeScript(Resource scriptContent, ParametersCallback parametersCallback)
Connection
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.
executeScript
in interface Connection
scriptContent
- script content. Cannot be null.parametersCallback
- callback to get parameter values. Cannot be null.public void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback)
Connection
executeQuery
in interface Connection
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.Connection.executeScript(scriptella.spi.Resource,scriptella.spi.ParametersCallback)
protected scriptella.jdbc.StatementCache newStatementCache()
public void commit()
Connection
Throwing an error during commit phase cause rollback
.
commit
in interface Connection
commit
in class AbstractConnection
public void rollback()
Connection
rollback
in interface Connection
rollback
in class AbstractConnection
public void flush() throws ProviderException
ProviderException
public void close()
Connection
close
in interface Connection
public java.sql.Connection getNativeConnection()
NativeConnectionProvider
getNativeConnection
in interface NativeConnectionProvider
public java.lang.String toString()
toString
in interface Connection
toString
in class AbstractConnection
Copyright © Copyright 2006-2019 The Scriptella Project Team.