Class AbstractFbDatabase<T extends AbstractConnection<IConnectionProperties,? extends FbDatabase>>
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbAttachment<T>
- 
- org.firebirdsql.gds.ng.AbstractFbDatabase<T>
 
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable,- FbAttachment,- FbDatabase,- ExceptionListenable,- TransactionListener
 - Direct Known Subclasses:
- AbstractFbWireDatabase,- JnaDatabase
 
 public abstract class AbstractFbDatabase<T extends AbstractConnection<IConnectionProperties,? extends FbDatabase>> extends AbstractFbAttachment<T> implements FbDatabase, TransactionListener Abstract implementation ofFbDatabasewith behavior common to the various implementations.- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected DatabaseListenerDispatcherdatabaseListenerDispatcher- 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentconnection, exceptionListenerDispatcher
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractFbDatabase(T connection, DatatypeCoder datatypeCoder)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddDatabaseListener(DatabaseListener listener)Adds aDatabaseListenerinstance to this database.voidaddWeakDatabaseListener(DatabaseListener listener)Adds aDatabaseListenerinstance to this database using a weak reference.voidclose()Detaches and closes the connection.BlobParameterBuffercreateBlobParameterBuffer()Creates a blob parameter buffer that is usable withFbDatabase.createBlobForInput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer, long)andFbDatabase.createBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer)of this instance.TransactionParameterBufferImplcreateTransactionParameterBuffer()Creates a transaction parameter buffer that is usable withFbDatabase.startTransaction(org.firebirdsql.gds.TransactionParameterBuffer).RowDescriptoremptyRowDescriptor()intgetActiveTransactionCount()shortgetConnectionDialect()IConnectionPropertiesgetConnectionProperties()shortgetDatabaseDialect()<R> RgetDatabaseInfo(byte[] requestItems, int bufferLength, InfoProcessor<R> infoProcessor)Request database info.protected InfoProcessor<FbDatabase>getDatabaseInformationProcessor()WarningMessageCallbackgetDatabaseWarningCallback()protected byte[]getDescribeDatabaseInfoBlock()intgetOdsMajor()intgetOdsMinor()byte[]getParameterDescriptionInfoRequestItems()byte[]getStatementInfoRequestItems()protected abstract voidinternalDetach()Actual implementation of database detach.voidremoveDatabaseListener(DatabaseListener listener)Removes aDatabaseListenerinstance from this database.protected voidsetDatabaseDialect(short dialect)Sets the dialect of the database.protected voidsetOdsMajor(int odsMajor)Sets the ODS (On Disk Structure) major version of the database associated with this connection.protected voidsetOdsMinor(int odsMinor)Sets the ODS (On Disk Structure) minor version of the database associated with this connection.protected voidtransactionAdded(FbTransaction transaction)Called when a transaction is added by the database.voidtransactionStateChanged(FbTransaction transaction, TransactionState newState, TransactionState previousState)Signals that the transaction state changed.- 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentaddExceptionListener, checkConnected, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getServerVersionInformation, getSynchronizationObject, isAttached, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenableaddExceptionListener, removeExceptionListener
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbAttachmentattach, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getSynchronizationObject, isAttached, setNetworkTimeout
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbDatabasecancelEvent, cancelOperation, countEvents, createBlobForInput, createBlobForOutput, createDatabase, createEventHandle, createStatement, dropDatabase, executeImmediate, getDatabaseInfo, getHandle, queueEvent, reconnectTransaction, startTransaction
 
- 
 
- 
- 
- 
Field Detail- 
databaseListenerDispatcherprotected final DatabaseListenerDispatcher databaseListenerDispatcher 
 
- 
 - 
Constructor Detail- 
AbstractFbDatabaseprotected AbstractFbDatabase(T connection, DatatypeCoder datatypeCoder) 
 
- 
 - 
Method Detail- 
getDatabaseWarningCallbackpublic final WarningMessageCallback getDatabaseWarningCallback() - Returns:
- The warning callback for this database.
 
 - 
getActiveTransactionCountpublic final int getActiveTransactionCount() - Returns:
- Number of active (not prepared or committed/rolled back) transactions
 
 - 
transactionAddedprotected final void transactionAdded(FbTransaction transaction) Called when a transaction is added by the database.Only this AbstractFbDatabaseinstance should call this method.
 - 
getConnectionDialectpublic final short getConnectionDialect() - Specified by:
- getConnectionDialectin interface- FbDatabase
- Returns:
- The client connection dialect
 
 - 
getDatabaseDialectpublic final short getDatabaseDialect() - Specified by:
- getDatabaseDialectin interface- FbDatabase
- Returns:
- The database dialect
 
 - 
setDatabaseDialectprotected final void setDatabaseDialect(short dialect) Sets the dialect of the database.This method should only be called by this instance. - Parameters:
- dialect- Dialect of the database/connection
 
 - 
addDatabaseListenerpublic final void addDatabaseListener(DatabaseListener listener) Description copied from interface:FbDatabaseAdds aDatabaseListenerinstance to this database.- Specified by:
- addDatabaseListenerin interface- FbDatabase
- Parameters:
- listener- Database listener
 
 - 
addWeakDatabaseListenerpublic final void addWeakDatabaseListener(DatabaseListener listener) Description copied from interface:FbDatabaseAdds aDatabaseListenerinstance to this database using a weak reference.If the listener is already strongly referenced, this call will be ignored - Specified by:
- addWeakDatabaseListenerin interface- FbDatabase
- Parameters:
- listener- Database listener
 
 - 
removeDatabaseListenerpublic final void removeDatabaseListener(DatabaseListener listener) Description copied from interface:FbDatabaseRemoves aDatabaseListenerinstance from this database.- Specified by:
- removeDatabaseListenerin interface- FbDatabase
- Parameters:
- listener- Database Listener
 
 - 
internalDetachprotected abstract void internalDetach() throws java.sql.SQLExceptionActual implementation of database detach.Implementations of this method should only be called from close(), and should not notify database listeners of the databaseDatabaseListener.detaching(FbDatabase)andDatabaseListener.detached(FbDatabase)events.- Throws:
- java.sql.SQLException
 
 - 
closepublic final void close() throws java.sql.SQLExceptionDetaches and closes the connection.Implementation note: Calls AbstractFbAttachment.checkConnected()and notifies database listeners of the detaching event, then callsinternalDetach()and finally notifies database listeners of database detach and removes all listeners.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- FbAttachment
- Throws:
- java.sql.SQLException- If not currently connected, or another problem occurred detaching.
 
 - 
getOdsMajorpublic final int getOdsMajor() - Specified by:
- getOdsMajorin interface- FbDatabase
- Returns:
- ODS major version
 
 - 
setOdsMajorprotected final void setOdsMajor(int odsMajor) Sets the ODS (On Disk Structure) major version of the database associated with this connection.This method should only be called by this instance. - Parameters:
- odsMajor- ODS major version
 
 - 
getOdsMinorpublic final int getOdsMinor() - Specified by:
- getOdsMinorin interface- FbDatabase
- Returns:
- ODS minor version
 
 - 
setOdsMinorprotected final void setOdsMinor(int odsMinor) Sets the ODS (On Disk Structure) minor version of the database associated with this connection.This method should only be called by this instance. - Parameters:
- odsMinor- The ODS minor version
 
 - 
getStatementInfoRequestItemspublic final byte[] getStatementInfoRequestItems() - Returns:
- The (full) statement info request items.
- See Also:
- getParameterDescriptionInfoRequestItems()
 
 - 
getParameterDescriptionInfoRequestItemspublic final byte[] getParameterDescriptionInfoRequestItems() - Returns:
- The isc_info_sql_describe_varsinfo request items.
- See Also:
- getStatementInfoRequestItems()
 
 - 
getDatabaseInfopublic final <R> R getDatabaseInfo(byte[] requestItems, int bufferLength, InfoProcessor<R> infoProcessor) throws java.sql.SQLExceptionDescription copied from interface:FbDatabaseRequest database info.- Specified by:
- getDatabaseInfoin interface- FbDatabase
- Parameters:
- requestItems- Array of info items to request
- bufferLength- Response buffer length to use
- infoProcessor- Implementation of- InfoProcessorto transform the info response
- Returns:
- Transformed info response of type T
- Throws:
- java.sql.SQLException- For errors retrieving or transforming the response.
 
 - 
getDescribeDatabaseInfoBlockprotected byte[] getDescribeDatabaseInfoBlock() 
 - 
getDatabaseInformationProcessorprotected InfoProcessor<FbDatabase> getDatabaseInformationProcessor() 
 - 
transactionStateChangedpublic final void transactionStateChanged(FbTransaction transaction, TransactionState newState, TransactionState previousState) Description copied from interface:TransactionListenerSignals that the transaction state changed.- Specified by:
- transactionStateChangedin interface- TransactionListener
- Parameters:
- transaction-- FbTransactionthat changed state
 
 - 
createBlobParameterBufferpublic BlobParameterBuffer createBlobParameterBuffer() Description copied from interface:FbDatabaseCreates a blob parameter buffer that is usable withFbDatabase.createBlobForInput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer, long)andFbDatabase.createBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer)of this instance.- Specified by:
- createBlobParameterBufferin interface- FbDatabase
- Returns:
- A blob parameter buffer.
 
 - 
createTransactionParameterBufferpublic TransactionParameterBufferImpl createTransactionParameterBuffer() Description copied from interface:FbDatabaseCreates a transaction parameter buffer that is usable withFbDatabase.startTransaction(org.firebirdsql.gds.TransactionParameterBuffer).- Specified by:
- createTransactionParameterBufferin interface- FbDatabase
- Returns:
- A transaction parameter buffer
 
 - 
getConnectionPropertiespublic IConnectionProperties getConnectionProperties() - Specified by:
- getConnectionPropertiesin interface- FbDatabase
- Returns:
- An immutable copy of the connection properties of this database
 
 - 
emptyRowDescriptorpublic final RowDescriptor emptyRowDescriptor() - Specified by:
- emptyRowDescriptorin interface- FbDatabase
- Returns:
- A potentially cached empty row descriptor for this database.
 
 
- 
 
-