public abstract class AbstractFbDatabase<T extends AbstractConnection<IConnectionProperties,? extends FbDatabase>> extends AbstractFbAttachment<T> implements FbDatabase, TransactionListener
FbDatabase
with behavior common to the various
implementations.connection, exceptionListenerDispatcher
Modifier | Constructor and Description |
---|---|
protected |
AbstractFbDatabase(T connection,
DatatypeCoder datatypeCoder) |
Modifier and Type | Method and Description |
---|---|
void |
addDatabaseListener(DatabaseListener listener)
Adds a
DatabaseListener instance to this database. |
void |
addWeakDatabaseListener(DatabaseListener listener)
Adds a
DatabaseListener instance to this database using a weak reference. |
void |
close()
Detaches and closes the connection.
|
BlobParameterBuffer |
createBlobParameterBuffer()
Creates a blob parameter buffer that is usable with
FbDatabase.createBlobForInput(FbTransaction,
org.firebirdsql.gds.BlobParameterBuffer, long)
and FbDatabase.createBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer) of this instance. |
TransactionParameterBufferImpl |
createTransactionParameterBuffer()
Creates a transaction parameter buffer that is usable with
FbDatabase.startTransaction(org.firebirdsql.gds.TransactionParameterBuffer) . |
RowDescriptor |
emptyRowDescriptor() |
int |
getActiveTransactionCount() |
short |
getConnectionDialect() |
IConnectionProperties |
getConnectionProperties() |
short |
getDatabaseDialect() |
<R> R |
getDatabaseInfo(byte[] requestItems,
int bufferLength,
InfoProcessor<R> infoProcessor)
Request database info.
|
protected InfoProcessor<FbDatabase> |
getDatabaseInformationProcessor() |
WarningMessageCallback |
getDatabaseWarningCallback() |
protected byte[] |
getDescribeDatabaseInfoBlock() |
int |
getOdsMajor() |
int |
getOdsMinor() |
byte[] |
getParameterDescriptionInfoRequestItems() |
byte[] |
getStatementInfoRequestItems() |
protected abstract void |
internalDetach()
Actual implementation of database detach.
|
void |
removeDatabaseListener(DatabaseListener listener)
Removes a
DatabaseListener instance from this database. |
protected void |
setDatabaseDialect(short dialect)
Sets the dialect of the database.
|
protected void |
setOdsMajor(int odsMajor)
Sets the ODS (On Disk Structure) major version of the database associated
with this connection.
|
protected void |
setOdsMinor(int odsMinor)
Sets the ODS (On Disk Structure) minor version of the database associated
with this connection.
|
protected void |
transactionAdded(FbTransaction transaction)
Called when a transaction is added by the database.
|
void |
transactionStateChanged(FbTransaction transaction,
TransactionState newState,
TransactionState previousState)
Signals that the transaction state changed.
|
addExceptionListener, checkConnected, createDbCryptCallback, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getServerVersionInformation, getSynchronizationObject, isAttached, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelEvent, cancelOperation, countEvents, createBlobForInput, createBlobForOutput, createDatabase, createEventHandle, createStatement, dropDatabase, executeImmediate, getDatabaseInfo, getHandle, queueEvent, reconnectTransaction, startTransaction
attach, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getSynchronizationObject, isAttached
addExceptionListener, removeExceptionListener
protected AbstractFbDatabase(T connection, DatatypeCoder datatypeCoder)
public final WarningMessageCallback getDatabaseWarningCallback()
public final int getActiveTransactionCount()
protected final void transactionAdded(FbTransaction transaction)
Only this AbstractFbDatabase
instance should call this method.
public final short getConnectionDialect()
getConnectionDialect
in interface FbDatabase
public final short getDatabaseDialect()
getDatabaseDialect
in interface FbDatabase
protected final void setDatabaseDialect(short dialect)
This method should only be called by this instance.
dialect
- Dialect of the database/connectionpublic final void addDatabaseListener(DatabaseListener listener)
FbDatabase
DatabaseListener
instance to this database.addDatabaseListener
in interface FbDatabase
listener
- Database listenerpublic final void addWeakDatabaseListener(DatabaseListener listener)
FbDatabase
DatabaseListener
instance to this database using a weak reference.
If the listener is already strongly referenced, this call will be ignored
addWeakDatabaseListener
in interface FbDatabase
listener
- Database listenerpublic final void removeDatabaseListener(DatabaseListener listener)
FbDatabase
DatabaseListener
instance from this database.removeDatabaseListener
in interface FbDatabase
listener
- Database Listenerprotected abstract void internalDetach() throws java.sql.SQLException
Implementations of this method should only be called from close()
, and should not
notify database listeners of the database DatabaseListener.detaching(FbDatabase)
and
DatabaseListener.detached(FbDatabase)
events.
java.sql.SQLException
public final void close() throws java.sql.SQLException
Implementation note: Calls AbstractFbAttachment.checkConnected()
and notifies database listeners of the detaching event, then
calls internalDetach()
and finally notifies database listeners of database detach and removes all
listeners.
close
in interface java.lang.AutoCloseable
close
in interface FbAttachment
java.sql.SQLException
- If not currently connected, or another problem occurred detaching.public final int getOdsMajor()
getOdsMajor
in interface FbDatabase
protected final void setOdsMajor(int odsMajor)
This method should only be called by this instance.
odsMajor
- ODS major versionpublic final int getOdsMinor()
getOdsMinor
in interface FbDatabase
protected final void setOdsMinor(int odsMinor)
This method should only be called by this instance.
odsMinor
- The ODS minor versionpublic final byte[] getStatementInfoRequestItems()
getParameterDescriptionInfoRequestItems()
public final byte[] getParameterDescriptionInfoRequestItems()
isc_info_sql_describe_vars
info request items.getStatementInfoRequestItems()
public final <R> R getDatabaseInfo(byte[] requestItems, int bufferLength, InfoProcessor<R> infoProcessor) throws java.sql.SQLException
FbDatabase
getDatabaseInfo
in interface FbDatabase
requestItems
- Array of info items to requestbufferLength
- Response buffer length to useinfoProcessor
- Implementation of InfoProcessor
to transform
the info responsejava.sql.SQLException
- For errors retrieving or transforming the response.protected byte[] getDescribeDatabaseInfoBlock()
protected InfoProcessor<FbDatabase> getDatabaseInformationProcessor()
public final void transactionStateChanged(FbTransaction transaction, TransactionState newState, TransactionState previousState)
TransactionListener
transactionStateChanged
in interface TransactionListener
transaction
- FbTransaction
that changed statepublic BlobParameterBuffer createBlobParameterBuffer()
FbDatabase
FbDatabase.createBlobForInput(FbTransaction,
org.firebirdsql.gds.BlobParameterBuffer, long)
and FbDatabase.createBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer)
of this instance.createBlobParameterBuffer
in interface FbDatabase
public TransactionParameterBufferImpl createTransactionParameterBuffer()
FbDatabase
FbDatabase.startTransaction(org.firebirdsql.gds.TransactionParameterBuffer)
.createTransactionParameterBuffer
in interface FbDatabase
public IConnectionProperties getConnectionProperties()
getConnectionProperties
in interface FbDatabase
public final RowDescriptor emptyRowDescriptor()
emptyRowDescriptor
in interface FbDatabase
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.