public abstract class AbstractConnection extends java.lang.Object implements Connection
Subclassing is more safe than directly implementing Connection
interface.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractConnection.StatementCounter
Helper class to use for executed statements counting.
|
Modifier and Type | Field and Description |
---|---|
protected AbstractConnection.StatementCounter |
counter |
Modifier | Constructor and Description |
---|---|
protected |
AbstractConnection()
May be used by sublasses to allow full customization
|
protected |
AbstractConnection(ConnectionParameters parameters)
Instantiates a connection with parameters.
|
protected |
AbstractConnection(DialectIdentifier dialectIdentifier,
ConnectionParameters parameters)
Instantiates a connection with dialectIdentifier and connection parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commits a current transaction (if any).
|
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.
|
boolean |
isReadonly()
Returns readonly mode.
|
void |
rollback()
Rolls back a current transaction (if any).
|
protected void |
setDialectIdentifier(DialectIdentifier dialectIdentifier) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, executeQuery, executeScript
protected final AbstractConnection.StatementCounter counter
protected AbstractConnection()
protected AbstractConnection(DialectIdentifier dialectIdentifier, ConnectionParameters parameters)
dialectIdentifier
- dialect identifier.parameters
- connection parameters to use for general properties.protected AbstractConnection(ConnectionParameters parameters)
parameters
- connection parameters to use for general properties.public DialectIdentifier getDialectIdentifier()
Connection
getDialectIdentifier
in interface Connection
protected void setDialectIdentifier(DialectIdentifier dialectIdentifier)
public long getExecutedStatementsCount()
Connection
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.
getExecutedStatementsCount
in interface Connection
public boolean isReadonly()
readonly=true means updates must be skipped by the driver. This property is configurable by readonly property of connection declaration element. Drivers are not required to support this feauture.
public void commit() throws ProviderException
Connection
Throwing an error during commit phase cause rollback
.
commit
in interface Connection
ProviderException
- if a problem occured during commit phase.public void rollback() throws ProviderException, java.lang.UnsupportedOperationException
Connection
rollback
in interface Connection
ProviderException
- if driver fails to roll back a transaction.java.lang.UnsupportedOperationException
- if transactions are not supportedpublic java.lang.String toString()
toString
in interface Connection
toString
in class java.lang.Object
Copyright © Copyright 2006-2019 The Scriptella Project Team.