public abstract class AbstractFbWireDatabase extends AbstractFbDatabase<WireDatabaseConnection> implements FbWireDatabase
FbWireAttachment.AcceptPacket
Modifier and Type | Field and Description |
---|---|
protected ProtocolDescriptor |
protocolDescriptor |
protected FbWireOperations |
wireOperations |
connection, exceptionListenerDispatcher
Modifier | Constructor and Description |
---|---|
protected |
AbstractFbWireDatabase(WireDatabaseConnection connection,
ProtocolDescriptor descriptor)
Creates an AbstractFbWireDatabase instance.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelEvent(EventHandle eventHandle)
Cancels a registered event.
|
protected void |
checkAttached()
Checks if a physical connection to the server is established and if the
connection is attached to a database.
|
protected void |
checkConnected()
Checks if a physical connection to the server is established.
|
protected void |
closeConnection()
Closes the WireConnection associated with this connection.
|
void |
consumePackets(int numberOfResponses,
WarningMessageCallback warningCallback)
Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.
|
void |
countEvents(EventHandle eventHandle)
Counts the events occurred.
|
FbBlob |
createBlobForInput(FbTransaction transaction,
BlobParameterBuffer blobParameterBuffer,
long blobId)
Creates a blob for read access to an existing blob on the server.
|
FbBlob |
createBlobForOutput(FbTransaction transaction,
BlobParameterBuffer blobParameterBuffer)
Creates a blob for write access to a new blob on the server.
|
EventHandle |
createEventHandle(java.lang.String eventName,
EventHandler eventHandler)
Creates an event handle for this database type.
|
protected void |
finalize() |
protected XdrInputStream |
getXdrIn()
Gets the XdrInputStream.
|
protected XdrOutputStream |
getXdrOut()
Gets the XdrOutputStream.
|
XdrStreamAccess |
getXdrStreamAccess() |
abstract FbWireAsynchronousChannel |
initAsynchronousChannel()
Initializes the asynchronous channel (for event notification).
|
boolean |
isAttached()
Current attachment status.
|
void |
queueEvent(EventHandle eventHandle)
Queues a wait for an event.
|
GenericResponse |
readGenericResponse(WarningMessageCallback warningCallback)
Convenience method to read a Response to a GenericResponse
|
Response |
readResponse(WarningMessageCallback warningCallback)
Reads the response from the server.
|
SqlResponse |
readSqlResponse(WarningMessageCallback warningCallback)
Convenience method to read a Response to a SqlResponse
|
addDatabaseListener, addWeakDatabaseListener, close, createBlobParameterBuffer, createTransactionParameterBuffer, emptyRowDescriptor, getActiveTransactionCount, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInformationProcessor, getDatabaseWarningCallback, getDescribeDatabaseInfoBlock, getOdsMajor, getOdsMinor, getParameterDescriptionInfoRequestItems, getStatementInfoRequestItems, internalDetach, removeDatabaseListener, setDatabaseDialect, setOdsMajor, setOdsMinor, transactionAdded, transactionStateChanged
addExceptionListener, createDbCryptCallback, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getServerVersionInformation, getSynchronizationObject, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
enqueueDeferredAction, getBlrCalculator, releaseObject
addDatabaseListener, addWeakDatabaseListener, cancelOperation, createBlobParameterBuffer, createDatabase, createStatement, createTransactionParameterBuffer, dropDatabase, emptyRowDescriptor, executeImmediate, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInfo, getHandle, getOdsMajor, getOdsMinor, reconnectTransaction, removeDatabaseListener, startTransaction
authReceiveResponse
attach, close, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getSynchronizationObject
addExceptionListener, removeExceptionListener
protected final ProtocolDescriptor protocolDescriptor
protected final FbWireOperations wireOperations
protected AbstractFbWireDatabase(WireDatabaseConnection connection, ProtocolDescriptor descriptor)
connection
- A WireConnection with an established connection to the server.descriptor
- The ProtocolDescriptor that created this connection (this is
used for creating further dependent objects).protected final XdrInputStream getXdrIn() throws java.sql.SQLException
java.sql.SQLException
- If no connection is opened or when exceptions occur
retrieving the InputStreamprotected final XdrOutputStream getXdrOut() throws java.sql.SQLException
java.sql.SQLException
- If no connection is opened or when exceptions occur
retrieving the OutputStreampublic final XdrStreamAccess getXdrStreamAccess()
getXdrStreamAccess
in interface FbWireAttachment
XdrStreamAccess
for this attachment.public final boolean isAttached()
FbAttachment
isAttached
in interface FbAttachment
isAttached
in class AbstractFbAttachment<WireDatabaseConnection>
true
if connected to the server and attached to a database or service, false
otherwise.protected final void checkConnected() throws java.sql.SQLException
checkConnected
in class AbstractFbAttachment<WireDatabaseConnection>
java.sql.SQLException
- If not connected.protected final void checkAttached() throws java.sql.SQLException
This method calls checkConnected()
, so it is not necessary to
call both.
java.sql.SQLException
- If the database not connected or attached.protected final void closeConnection() throws java.io.IOException
java.io.IOException
- For errors closing the connection.public final FbBlob createBlobForOutput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer)
FbDatabase
The blob is initially closed.
createBlobForOutput
in interface FbDatabase
transaction
- Transaction associated with the blob.blobParameterBuffer
- Blob Parameter BufferFbBlob
public final FbBlob createBlobForInput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)
FbDatabase
The blob is initially closed.
createBlobForInput
in interface FbDatabase
transaction
- Transaction associated with the blob.blobParameterBuffer
- Blob Parameter BufferblobId
- Handle id of the blobFbBlob
public final void consumePackets(int numberOfResponses, WarningMessageCallback warningCallback)
FbWireDatabase
This method should only be used inside the implementation if either packets need to be ignored, or to ensure that there is no backlog of packets (eg when an exception occurs during processing of multiple package responses).
consumePackets
in interface FbWireDatabase
numberOfResponses
- Number of responses to consume.warningCallback
- Callback for warningspublic final GenericResponse readGenericResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException
FbWireAttachment
readGenericResponse
in interface FbWireAttachment
warningCallback
- Callback object for warnings, null
for default callbackjava.sql.SQLException
- For errors returned from the server, or when attempting to
read.java.io.IOException
- For errors reading the response from the connection.public final SqlResponse readSqlResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException
FbWireDatabase
readSqlResponse
in interface FbWireDatabase
warningCallback
- Callback object for warnings, null
for default callbackjava.sql.SQLException
- For errors returned from the server, or when attempting to
read.java.io.IOException
- For errors reading the response from the connection.public final Response readResponse(WarningMessageCallback warningCallback) throws java.sql.SQLException, java.io.IOException
FbWireDatabase
readResponse
in interface FbWireDatabase
warningCallback
- Callback object for warnings, null
for default callbackResponse
read.java.sql.SQLException
- For errors returned from the server, or when attempting to readjava.io.IOException
- For errors reading the response from the connection.public final EventHandle createEventHandle(java.lang.String eventName, EventHandler eventHandler)
FbDatabase
The returned event handle can be used with FbDatabase.queueEvent(org.firebirdsql.gds.EventHandle)
.
createEventHandle
in interface FbDatabase
eventName
- Name of the eventeventHandler
- The event handler to call when the event occurredpublic final void queueEvent(EventHandle eventHandle) throws java.sql.SQLException
FbDatabase
queueEvent
in interface FbDatabase
eventHandle
- The event handle (created using FbDatabase.createEventHandle(String, EventHandler)
of this instance).java.sql.SQLException
- For errors establishing the asynchronous channel, or for queuing the event.public final void cancelEvent(EventHandle eventHandle) throws java.sql.SQLException
FbDatabase
After cancellation, the event handle should be considered unusable. Before queueing a new event, an new handle needs to be created.
cancelEvent
in interface FbDatabase
eventHandle
- The event handle to canceljava.sql.SQLException
- For errors cancelling the eventpublic final void countEvents(EventHandle eventHandle) throws java.sql.SQLException
FbDatabase
countEvents
in interface FbDatabase
eventHandle
- The event handlejava.sql.SQLException
- When the count can not be done (as - for example - the event handle is of the wrong type)public abstract FbWireAsynchronousChannel initAsynchronousChannel() throws java.sql.SQLException
java.sql.SQLException
- For errors establishing the channel, or if the channel already exists.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.