public abstract class AbstractFbDatabase<T extends AbstractConnection<IConnectionProperties,? extends FbDatabase>> extends AbstractFbAttachment<T> implements FbDatabase, TransactionListener
FbDatabase with behavior common to the various
implementations.| Modifier and Type | Field and Description |
|---|---|
protected DatabaseListenerDispatcher |
databaseListenerDispatcher |
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, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getServerVersionInformation, isAttached, isLockedByCurrentThread, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion, withLockclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcancelEvent, cancelOperation, countEvents, createBlobForInput, createBlobForInput, createBlobForInput, createBlobForOutput, createBlobForOutput, createBlobForOutput, createDatabase, createEventHandle, createStatement, dropDatabase, executeImmediate, getDatabaseInfo, getHandle, queueEvent, reconnectTransaction, startTransactionattach, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, isAttached, isLockedByCurrentThread, setNetworkTimeout, withLockaddExceptionListener, removeExceptionListenerprotected final DatabaseListenerDispatcher databaseListenerDispatcher
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 FbDatabasepublic final short getDatabaseDialect()
getDatabaseDialect in interface FbDatabaseprotected 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)
FbDatabaseDatabaseListener instance to this database.addDatabaseListener in interface FbDatabaselistener - Database listenerpublic final void addWeakDatabaseListener(DatabaseListener listener)
FbDatabaseDatabaseListener instance to this database using a weak reference.
If the listener is already strongly referenced, this call will be ignored
addWeakDatabaseListener in interface FbDatabaselistener - Database listenerpublic final void removeDatabaseListener(DatabaseListener listener)
FbDatabaseDatabaseListener instance from this database.removeDatabaseListener in interface FbDatabaselistener - 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.SQLExceptionpublic 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.AutoCloseableclose in interface FbAttachmentjava.sql.SQLException - If not currently connected, or another problem occurred detaching.public final int getOdsMajor()
getOdsMajor in interface FbDatabaseprotected final void setOdsMajor(int odsMajor)
This method should only be called by this instance.
odsMajor - ODS major versionpublic final int getOdsMinor()
getOdsMinor in interface FbDatabaseprotected 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
FbDatabasegetDatabaseInfo in interface FbDatabaserequestItems - 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)
TransactionListenertransactionStateChanged in interface TransactionListenertransaction - FbTransaction that changed statepublic BlobParameterBuffer createBlobParameterBuffer()
FbDatabaseFbDatabase.createBlobForInput(FbTransaction,
org.firebirdsql.gds.BlobParameterBuffer, long)
and FbDatabase.createBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer) of this instance.createBlobParameterBuffer in interface FbDatabasepublic TransactionParameterBufferImpl createTransactionParameterBuffer()
FbDatabaseFbDatabase.startTransaction(org.firebirdsql.gds.TransactionParameterBuffer).createTransactionParameterBuffer in interface FbDatabasepublic IConnectionProperties getConnectionProperties()
getConnectionProperties in interface FbDatabasepublic final RowDescriptor emptyRowDescriptor()
emptyRowDescriptor in interface FbDatabaseCopyright © 2001-2023 Jaybird (Firebird JDBC) team. All rights reserved.