public class V10Database extends AbstractFbWireDatabase implements FbWireDatabase
FbWireDatabase
implementation for the version 10 wire protocol.FbWireAttachment.AcceptPacket
protocolDescriptor, wireOperations
connection, exceptionListenerDispatcher
Modifier | Constructor and Description |
---|---|
protected |
V10Database(WireDatabaseConnection connection,
ProtocolDescriptor descriptor)
Creates a V10Database instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterAttachActions()
Additional tasks to execute directly after attach operation.
|
void |
attach()
Attach to the attachment type.
|
protected void |
attachOrCreate(DatabaseParameterBuffer dpb,
boolean create) |
void |
authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket)
Receive authentication response from the server.
|
void |
cancelOperation(int kind)
Cancels the current operation.
|
void |
createDatabase()
Creates a new database, connection remains attached to database.
|
FbStatement |
createStatement(FbTransaction transaction)
Creates a statement associated with a transaction
|
protected void |
doReleaseObjectPacket(int operation,
int objectId)
Sends - without flushing - the (release) operation and objectId.
|
void |
dropDatabase()
Drops (and deletes) the currently attached database.
|
void |
enqueueDeferredAction(DeferredAction deferredAction)
Enqueue a deferred action.
|
void |
executeImmediate(java.lang.String statementText,
FbTransaction transaction)
Performs an execute immediate of a statement.
|
BlrCalculator |
getBlrCalculator() |
byte[] |
getDatabaseInfo(byte[] requestItems,
int maxBufferLength)
Performs a database info request.
|
protected Encoding |
getFilenameEncoding(DatabaseParameterBuffer dpb)
Gets the
Encoding to use for the database filename. |
int |
getHandle() |
protected byte[] |
getTransactionIdBuffer(long transactionId) |
FbWireAsynchronousChannel |
initAsynchronousChannel()
Initializes the asynchronous channel (for event notification).
|
protected void |
internalDetach()
Actual implementation of database detach.
|
protected void |
processAttachOrCreateResponse(GenericResponse genericResponse)
Processes the response from the server to the attach or create operation.
|
protected void |
processReleaseObjectResponse(Response response)
Process the release object response
|
FbTransaction |
reconnectTransaction(long transactionId)
Reconnects a prepared transaction.
|
void |
releaseObject(int operation,
int objectId)
Release object.
|
protected void |
sendAttachOrCreateToBuffer(DatabaseParameterBuffer dpb,
boolean create)
Sends the buffer for op_attach or op_create
|
FbWireTransaction |
startTransaction(TransactionParameterBuffer tpb)
Creates and starts a transaction.
|
cancelEvent, checkAttached, checkConnected, closeConnection, consumePackets, countEvents, createBlobForInput, createBlobForOutput, createEventHandle, finalize, getXdrIn, getXdrOut, getXdrStreamAccess, isAttached, queueEvent, readGenericResponse, readResponse, readSqlResponse
addDatabaseListener, addWeakDatabaseListener, close, createBlobParameterBuffer, createTransactionParameterBuffer, emptyRowDescriptor, getActiveTransactionCount, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInformationProcessor, getDatabaseWarningCallback, getDescribeDatabaseInfoBlock, getOdsMajor, getOdsMinor, getParameterDescriptionInfoRequestItems, getStatementInfoRequestItems, 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
consumePackets, readResponse, readSqlResponse
addDatabaseListener, addWeakDatabaseListener, cancelEvent, countEvents, createBlobForInput, createBlobForOutput, createBlobParameterBuffer, createEventHandle, createTransactionParameterBuffer, emptyRowDescriptor, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getOdsMajor, getOdsMinor, queueEvent, removeDatabaseListener
getXdrStreamAccess, readGenericResponse
close, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getSynchronizationObject, isAttached
addExceptionListener, removeExceptionListener
protected V10Database(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).public final int getHandle()
getHandle
in interface FbAttachment
getHandle
in interface FbDatabase
public final void attach() throws java.sql.SQLException
FbAttachment
attach
in interface FbAttachment
java.sql.SQLException
protected final void attachOrCreate(DatabaseParameterBuffer dpb, boolean create) throws java.sql.SQLException
dpb
- Database parameter buffercreate
- true
create database, false
only
attachjava.sql.SQLException
- For errors during attach or createprotected final void sendAttachOrCreateToBuffer(DatabaseParameterBuffer dpb, boolean create) throws java.sql.SQLException, java.io.IOException
dpb
- Database parameter buffercreate
- true
create database, false
only
attachjava.sql.SQLException
- If the connection is not openjava.io.IOException
- For errors writing to the connectionprotected Encoding getFilenameEncoding(DatabaseParameterBuffer dpb)
Encoding
to use for the database filename.dpb
- Database parameter bufferprotected final void processAttachOrCreateResponse(GenericResponse genericResponse)
genericResponse
- GenericResponse received from the server.protected final void afterAttachActions() throws java.sql.SQLException
Implementation retrieves database information like dialect ODS and server version.
java.sql.SQLException
- For errors reading or writing database information.protected final void internalDetach() throws java.sql.SQLException
AbstractFbDatabase
Implementations of this method should only be called from AbstractFbDatabase.close()
, and should not
notify database listeners of the database DatabaseListener.detaching(FbDatabase)
and
DatabaseListener.detached(FbDatabase)
events.
internalDetach
in class AbstractFbDatabase<WireDatabaseConnection>
java.sql.SQLException
public final void createDatabase() throws java.sql.SQLException
FbDatabase
createDatabase
in interface FbDatabase
java.sql.SQLException
public final void dropDatabase() throws java.sql.SQLException
FbDatabase
dropDatabase
in interface FbDatabase
java.sql.SQLException
public final FbWireTransaction startTransaction(TransactionParameterBuffer tpb) throws java.sql.SQLException
FbDatabase
startTransaction
in interface FbDatabase
tpb
- TransactionParameterBuffer with the required transaction
optionsjava.sql.SQLException
public final FbTransaction reconnectTransaction(long transactionId) throws java.sql.SQLException
FbDatabase
Reconnecting transactions is only allowed for transactions in limbo (prepared, but not committed or rolled back).
reconnectTransaction
in interface FbDatabase
transactionId
- The id of the transaction to reconnect.java.sql.SQLException
- For errors reconnecting the transactionprotected byte[] getTransactionIdBuffer(long transactionId)
public final FbStatement createStatement(FbTransaction transaction) throws java.sql.SQLException
FbDatabase
createStatement
in interface FbDatabase
transaction
- FbTransaction to associate with this statement (can be null
).java.sql.SQLException
public void cancelOperation(int kind) throws java.sql.SQLException
FbDatabase
The cancellation types are:
ISCConstants.fb_cancel_disable
ISCConstants.fb_cancel_enable
ISCConstants.fb_cancel_raise
ISCConstants.fb_cancel_abort
cancelOperation
in interface FbDatabase
kind
- Cancellation typejava.sql.SQLException
- For errors cancelling, or if the cancel operation is not supported.public final byte[] getDatabaseInfo(byte[] requestItems, int maxBufferLength) throws java.sql.SQLException
FbDatabase
getDatabaseInfo
in interface FbDatabase
requestItems
- Information items to requestmaxBufferLength
- Maximum response buffer length to usemaxBufferLength
java.sql.SQLException
- For errors retrieving the information.public final void executeImmediate(java.lang.String statementText, FbTransaction transaction) throws java.sql.SQLException
FbDatabase
A call to this method is the equivalent of a isc_dsql_execute_immediate()
without parameters.
executeImmediate
in interface FbDatabase
statementText
- Statement texttransaction
- Transaction (null
only allowed if database is not attached!)java.sql.SQLException
- For errors executing the statement, or if transaction
is null
when the
database is attached or not null
when the database is not attachedpublic void releaseObject(int operation, int objectId) throws java.sql.SQLException
FbWireDatabase
releaseObject
in interface FbWireDatabase
operation
- OperationobjectId
- Id of the object to releasejava.sql.SQLException
public final FbWireAsynchronousChannel initAsynchronousChannel() throws java.sql.SQLException
AbstractFbWireDatabase
initAsynchronousChannel
in class AbstractFbWireDatabase
java.sql.SQLException
- For errors establishing the channel, or if the channel already exists.protected final void doReleaseObjectPacket(int operation, int objectId) throws java.io.IOException, java.sql.SQLException
operation
- OperationobjectId
- Id of the object to releasejava.io.IOException
- For errors writing to the connectionjava.sql.SQLException
- If the database connection is not availableprotected final void processReleaseObjectResponse(Response response)
response
- The response objectpublic final BlrCalculator getBlrCalculator()
getBlrCalculator
in interface FbWireDatabase
BlrCalculator
instance for this database.public void enqueueDeferredAction(DeferredAction deferredAction)
FbWireDatabase
FbDatabase implementations that do not support deferred actions are allowed to throw an
UnsupportedOperationException
enqueueDeferredAction
in interface FbWireDatabase
deferredAction
- Deferred actionpublic final void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket) throws java.io.IOException, java.sql.SQLException
FbWireAttachment
This method is only relevant for protocol V13 or higher.
authReceiveResponse
in interface FbWireAttachment
acceptPacket
- Packet with op_cond_accept
data, or null
when the data should be read from the
connection.java.io.IOException
- For errors reading the response from the connection.java.sql.SQLException
- For errors returned from the server, or when attempting to
read.Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.