DS
- the generic typepublic abstract class AbstractDBConnection<DS extends DBDataSource<DS>> extends Object implements DBConnection<DS>
A abstract class from the DBConnection
. A connection (session)
with a specific database. SQL statements are executed and results are
returned within the context of a connection.
DBDataSource
,
DBConnection
DBConnection.Query
Modifier and Type | Field and Description |
---|---|
protected DS |
dataSource |
protected List<DBConnectionListener> |
listeners |
Constructor and Description |
---|
AbstractDBConnection(DS dataSource)
Constructs a
AbstractDBConnection that is initialized with the
originating data source. |
Modifier and Type | Method and Description |
---|---|
void |
addDBConnectionListener(DBConnectionListener l)
Registers a
DBConnectionListener at this connection. |
protected void |
decorateDelegate(Object query,
DatabaseGateway gateway)
Quick and dirty way to inject the gateway into a xdev.db.sql object
|
DS |
getDataSource()
Returns the data source of this
AbstractDBConnection . |
DBConnectionListener[] |
getDBConnectionListeners()
Retrieves all registered
DBConnectionListener s. |
DBConnection.Query[] |
getStoredQueries()
Returns all stored queries since the
setStoreQueries(true)
was called. |
protected void |
queryPerformed(String statement,
Object[] params,
DBException exception) |
void |
removeDBConnectionListener(DBConnectionListener l)
Unregisters a
DBConnectionListener . |
void |
setStoreQueries(boolean store)
Stores all queries which are executed from now on if
store
is true , otherwise all stored queries will be deleted. |
protected void |
writePerformed(String statement,
Object[] params,
DBException exception) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
beginTransaction, call, close, commit, createTable, getPager, getQueryRowCount, getServerTime, isInTransaction, query, query, releaseSavepoint, rollback, rollback, setSavepoint, setSavepoint, testConnection, write, write, write, write, write
protected final DS extends DBDataSource<DS> dataSource
protected List<DBConnectionListener> listeners
public AbstractDBConnection(DS dataSource)
AbstractDBConnection
that is initialized with the
originating data source.dataSource
- The originating data sourcepublic DS getDataSource()
AbstractDBConnection
.public void addDBConnectionListener(DBConnectionListener l)
DBConnectionListener
at this connection.addDBConnectionListener
in interface DBConnection<DS extends DBDataSource<DS>>
l
- the listener to registerpublic void removeDBConnectionListener(DBConnectionListener l)
DBConnectionListener
.removeDBConnectionListener
in interface DBConnection<DS extends DBDataSource<DS>>
l
- the listener to unregisterpublic DBConnectionListener[] getDBConnectionListeners()
DBConnectionListener
s.getDBConnectionListeners
in interface DBConnection<DS extends DBDataSource<DS>>
DBConnectionListener
s, or a null-length array
if no listener is registeredpublic void setStoreQueries(boolean store)
store
is true
, otherwise all stored queries will be deleted.setStoreQueries
in interface DBConnection<DS extends DBDataSource<DS>>
store
- if true
all queries which are executed from now
are stored, otherwise all stored queries will be deletedDBConnection.getStoredQueries()
public DBConnection.Query[] getStoredQueries()
setStoreQueries(true)
was called. If the flag is false
a empty array is returned.getStoredQueries
in interface DBConnection<DS extends DBDataSource<DS>>
DBConnection.setStoreQueries(boolean)
protected void queryPerformed(String statement, Object[] params, DBException exception)
protected void writePerformed(String statement, Object[] params, DBException exception)
protected void decorateDelegate(Object query, DatabaseGateway gateway)
Copyright © 2003–2021 XDEV Software. All rights reserved.