Class V10Database
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbAttachment<T>
- 
- org.firebirdsql.gds.ng.AbstractFbDatabase<WireDatabaseConnection>
- 
- org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase
- 
- org.firebirdsql.gds.ng.wire.version10.V10Database
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable,- FbAttachment,- FbDatabase,- ExceptionListenable,- TransactionListener,- FbWireAttachment,- FbWireDatabase
 - Direct Known Subclasses:
- V11Database
 
 public class V10Database extends AbstractFbWireDatabase implements FbWireDatabase FbWireDatabaseimplementation for the version 10 wire protocol.- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.wire.FbWireAttachmentFbWireAttachment.AcceptPacket
 
- 
 - 
Field Summary- 
Fields inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireDatabaseprotocolDescriptor, wireOperations
 - 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbDatabasedatabaseListenerDispatcher
 - 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentconnection, exceptionListenerDispatcher
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedV10Database(WireDatabaseConnection connection, ProtocolDescriptor descriptor)Creates a V10Database instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterAttachActions()Additional tasks to execute directly after attach operation.voidattach()Attach to the attachment type.protected voidattachOrCreate(DatabaseParameterBuffer dpb, boolean create)voidauthReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket)Receive authentication response from the server.voidcancelOperation(int kind)Cancels the current operation.voidcreateDatabase()Creates a new database, connection remains attached to database.FbStatementcreateStatement(FbTransaction transaction)Creates a statement associated with a transactionprotected voiddoReleaseObjectPacket(int operation, int objectId)Sends - without flushing - the (release) operation and objectId.voiddropDatabase()Drops (and deletes) the currently attached database.voidexecuteImmediate(java.lang.String statementText, FbTransaction transaction)Performs an execute immediate of a statement.BlrCalculatorgetBlrCalculator()protected EncodinggetFilenameEncoding(DatabaseParameterBuffer dpb)Gets theEncodingto use for the database filename.protected byte[]getTransactionIdBuffer(long transactionId)FbWireAsynchronousChannelinitAsynchronousChannel()Initializes the asynchronous channel (for event notification).protected voidinternalDetach()Actual implementation of database detach.protected voidprocessAttachOrCreateResponse(GenericResponse genericResponse)Processes the response from the server to the attach or create operation.protected voidprocessReleaseObjectResponse(Response response)Process the release object responseFbTransactionreconnectTransaction(long transactionId)Reconnects a prepared transaction.voidreleaseObject(int operation, int objectId)Release object.protected voidsendAttachOrCreateToBuffer(DatabaseParameterBuffer dpb, boolean create)Sends the buffer for op_attach or op_createFbWireTransactionstartTransaction(TransactionParameterBuffer tpb)Creates and starts a transaction.- 
Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireDatabasecancelEvent, checkAttached, checkConnected, closeConnection, consumePackets, countEvents, createBlobForInput, createBlobForOutput, createEventHandle, enqueueDeferredAction, finalize, forceClose, getDatabaseInfo, getHandle, getInfo, getWireOperations, getXdrIn, getXdrOut, getXdrStreamAccess, isAttached, queueEvent, readGenericResponse, readResponse, readSqlResponse, setNetworkTimeout
 - 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbDatabaseaddDatabaseListener, addWeakDatabaseListener, close, createBlobParameterBuffer, createTransactionParameterBuffer, emptyRowDescriptor, getActiveTransactionCount, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInformationProcessor, getDatabaseWarningCallback, getDescribeDatabaseInfoBlock, getOdsMajor, getOdsMinor, getParameterDescriptionInfoRequestItems, getStatementInfoRequestItems, removeDatabaseListener, setDatabaseDialect, setOdsMajor, setOdsMinor, transactionAdded, transactionStateChanged
 - 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachmentaddExceptionListener, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, getServerVersionInformation, isLockedByCurrentThread, removeExceptionListener, safelyDetach, setAttached, setDetached, setServerVersion, withLock
 - 
Methods inherited from class java.lang.Objectclone, equals, 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.FbAttachmentclose, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, isAttached, isLockedByCurrentThread, setNetworkTimeout, withLock
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbDatabaseaddDatabaseListener, addWeakDatabaseListener, cancelEvent, countEvents, createBlobForInput, createBlobForInput, createBlobForInput, createBlobForOutput, createBlobForOutput, createBlobForOutput, createBlobParameterBuffer, createEventHandle, createTransactionParameterBuffer, emptyRowDescriptor, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInfo, getHandle, getOdsMajor, getOdsMinor, queueEvent, removeDatabaseListener
 - 
Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireAttachmentgetWireOperations, getXdrStreamAccess, readGenericResponse
 - 
Methods inherited from interface org.firebirdsql.gds.ng.wire.FbWireDatabaseconsumePackets, enqueueDeferredAction, getInfo, readResponse, readSqlResponse
 
- 
 
- 
- 
- 
Constructor Detail- 
V10Databaseprotected V10Database(WireDatabaseConnection connection, ProtocolDescriptor descriptor) Creates a V10Database instance.- Parameters:
- 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).
 
 
- 
 - 
Method Detail- 
attachpublic final void attach() throws java.sql.SQLExceptionDescription copied from interface:FbAttachmentAttach to the attachment type.- Specified by:
- attachin interface- FbAttachment
- Throws:
- java.sql.SQLException
 
 - 
attachOrCreateprotected final void attachOrCreate(DatabaseParameterBuffer dpb, boolean create) throws java.sql.SQLException - Parameters:
- dpb- Database parameter buffer
- create-- truecreate database,- falseonly attach
- Throws:
- java.sql.SQLException- For errors during attach or create
 
 - 
sendAttachOrCreateToBufferprotected final void sendAttachOrCreateToBuffer(DatabaseParameterBuffer dpb, boolean create) throws java.sql.SQLException, java.io.IOException Sends the buffer for op_attach or op_create- Parameters:
- dpb- Database parameter buffer
- create-- truecreate database,- falseonly attach
- Throws:
- java.sql.SQLException- If the connection is not open
- java.io.IOException- For errors writing to the connection
 
 - 
getFilenameEncodingprotected Encoding getFilenameEncoding(DatabaseParameterBuffer dpb) Gets theEncodingto use for the database filename.- Parameters:
- dpb- Database parameter buffer
- Returns:
- Encoding
 
 - 
processAttachOrCreateResponseprotected final void processAttachOrCreateResponse(GenericResponse genericResponse) Processes the response from the server to the attach or create operation.- Parameters:
- genericResponse- GenericResponse received from the server.
 
 - 
afterAttachActionsprotected final void afterAttachActions() throws java.sql.SQLExceptionAdditional tasks to execute directly after attach operation.Implementation retrieves database information like dialect ODS and server version. - Throws:
- java.sql.SQLException- For errors reading or writing database information.
 
 - 
internalDetachprotected final void internalDetach() throws java.sql.SQLExceptionDescription copied from class:AbstractFbDatabaseActual implementation of database detach.Implementations of this method should only be called from AbstractFbDatabase.close(), and should not notify database listeners of the databaseDatabaseListener.detaching(FbDatabase)andDatabaseListener.detached(FbDatabase)events.- Specified by:
- internalDetachin class- AbstractFbDatabase<WireDatabaseConnection>
- Throws:
- java.sql.SQLException
 
 - 
createDatabasepublic final void createDatabase() throws java.sql.SQLExceptionDescription copied from interface:FbDatabaseCreates a new database, connection remains attached to database.- Specified by:
- createDatabasein interface- FbDatabase
- Throws:
- java.sql.SQLException
 
 - 
dropDatabasepublic final void dropDatabase() throws java.sql.SQLExceptionDescription copied from interface:FbDatabaseDrops (and deletes) the currently attached database.- Specified by:
- dropDatabasein interface- FbDatabase
- Throws:
- java.sql.SQLException
 
 - 
startTransactionpublic final FbWireTransaction startTransaction(TransactionParameterBuffer tpb) throws java.sql.SQLException Description copied from interface:FbDatabaseCreates and starts a transaction.- Specified by:
- startTransactionin interface- FbDatabase
- Parameters:
- tpb- TransactionParameterBuffer with the required transaction options
- Returns:
- FbTransaction
- Throws:
- java.sql.SQLException
 
 - 
reconnectTransactionpublic final FbTransaction reconnectTransaction(long transactionId) throws java.sql.SQLException Description copied from interface:FbDatabaseReconnects a prepared transaction.Reconnecting transactions is only allowed for transactions in limbo (prepared, but not committed or rolled back). - Specified by:
- reconnectTransactionin interface- FbDatabase
- Parameters:
- transactionId- The id of the transaction to reconnect.
- Returns:
- FbTransaction
- Throws:
- java.sql.SQLException- For errors reconnecting the transaction
 
 - 
getTransactionIdBufferprotected byte[] getTransactionIdBuffer(long transactionId) 
 - 
createStatementpublic final FbStatement createStatement(FbTransaction transaction) throws java.sql.SQLException Description copied from interface:FbDatabaseCreates a statement associated with a transaction- Specified by:
- createStatementin interface- FbDatabase
- Parameters:
- transaction- FbTransaction to associate with this statement (can be- null)
- Returns:
- FbStatement
- Throws:
- java.sql.SQLException
 
 - 
cancelOperationpublic void cancelOperation(int kind) throws java.sql.SQLExceptionDescription copied from interface:FbDatabaseCancels the current operation.The cancellation types are: - ISCConstants.fb_cancel_disable
- disables execution of fb_cancel_raise requests for the specified attachment. It can be useful when your program is executing critical operations, such as cleanup, for example.
- ISCConstants.fb_cancel_enable
- re-enables delivery of a cancel execution that was previously disabled. The 'cancel' state is effective by default, being initialized when the attachment is created.
- ISCConstants.fb_cancel_raise
- cancels any activity related to the database handle. The effect will be that, as soon as possible, the engine will try to stop the running request and return an exception to the caller
- ISCConstants.fb_cancel_abort
- forcibly close client side of connection. Useful if you need to close a connection urgently. All active transactions will be rolled back by the server. 'Success' is always returned to the application. Use with care!
 - Specified by:
- cancelOperationin interface- FbDatabase
- Parameters:
- kind- Cancellation type
- Throws:
- java.sql.SQLException- For errors cancelling, or if the cancel operation is not supported.
 
 - 
executeImmediatepublic final void executeImmediate(java.lang.String statementText, FbTransaction transaction) throws java.sql.SQLExceptionDescription copied from interface:FbDatabasePerforms an execute immediate of a statement.A call to this method is the equivalent of a isc_dsql_execute_immediate()without parameters.- Specified by:
- executeImmediatein interface- FbDatabase
- Parameters:
- statementText- Statement text
- transaction- Transaction (- nullonly allowed if database is not attached!)
- Throws:
- java.sql.SQLException- For errors executing the statement, or if- transactionis- nullwhen the database is attached or not- nullwhen the database is not attached
 
 - 
releaseObjectpublic void releaseObject(int operation, int objectId) throws java.sql.SQLExceptionDescription copied from interface:FbWireDatabaseRelease object.- Specified by:
- releaseObjectin interface- FbWireDatabase
- Parameters:
- operation- Operation
- objectId- ID of the object to release
- Throws:
- java.sql.SQLException
 
 - 
initAsynchronousChannelpublic final FbWireAsynchronousChannel initAsynchronousChannel() throws java.sql.SQLException Description copied from class:AbstractFbWireDatabaseInitializes the asynchronous channel (for event notification).- Specified by:
- initAsynchronousChannelin class- AbstractFbWireDatabase
- Throws:
- java.sql.SQLException- For errors establishing the channel, or if the channel already exists.
 
 - 
doReleaseObjectPacketprotected final void doReleaseObjectPacket(int operation, int objectId) throws java.io.IOException, java.sql.SQLExceptionSends - without flushing - the (release) operation and objectId.- Parameters:
- operation- Operation
- objectId- Id of the object to release
- Throws:
- java.io.IOException- For errors writing to the connection
- java.sql.SQLException- If the database connection is not available
 
 - 
processReleaseObjectResponseprotected final void processReleaseObjectResponse(Response response) Process the release object response- Parameters:
- response- The response object
 
 - 
getBlrCalculatorpublic final BlrCalculator getBlrCalculator() - Specified by:
- getBlrCalculatorin interface- FbWireDatabase
- Returns:
- The BlrCalculatorinstance for this database.
 
 - 
authReceiveResponsepublic final void authReceiveResponse(FbWireAttachment.AcceptPacket acceptPacket) throws java.io.IOException, java.sql.SQLException Description copied from interface:FbWireAttachmentReceive authentication response from the server.This method is only relevant for protocol V13 or higher. - Specified by:
- authReceiveResponsein interface- FbWireAttachment
- Parameters:
- acceptPacket- Packet with- op_cond_acceptdata, or- nullwhen the data should be read from the connection.
- Throws:
- 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.
 
 
- 
 
-