- All Superinterfaces:
AutoCloseable
,ExceptionListenable
,FbAttachment
- All Known Subinterfaces:
FbWireDatabase
- All Known Implementing Classes:
AbstractFbDatabase
,AbstractFbWireDatabase
,V10Database
,V11Database
,V12Database
,V13Database
,V15Database
,V16Database
,V18Database
All methods defined in this interface are required to notify all SQLException
thrown from the methods
defined in this interface, and those exceptions notified by all ExceptionListenable
implementations created
from them.
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDatabaseListener
(DatabaseListener listener) Adds aDatabaseListener
instance to this database.void
addWeakDatabaseListener
(DatabaseListener listener) Adds aDatabaseListener
instance to this database using a weak reference.void
cancelEvent
(EventHandle eventHandle) Cancels a registered event.void
cancelOperation
(int kind) Cancels the current operation.void
countEvents
(EventHandle eventHandle) Counts the events occurred.default FbBlob
createBlobForInput
(FbTransaction transaction, long blobId) Creates a blob for read access to an existing blob on the server.createBlobForInput
(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId) Creates a blob for read access to an existing blob on the server.default FbBlob
createBlobForInput
(FbTransaction transaction, BlobConfig blobConfig, long blobId) Creates a blob for read access to an existing blob on the server.default FbBlob
createBlobForOutput
(FbTransaction transaction) Creates a blob for write access to a new blob on the server.createBlobForOutput
(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer) Creates a blob for write access to a new blob on the server.default FbBlob
createBlobForOutput
(FbTransaction transaction, BlobConfig blobConfig) Creates a blob for write access to a new blob on the server.Creates a blob parameter buffer that is usable withcreateBlobForInput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer, long)
andcreateBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer)
of this instance.void
Creates a new database, connection remains attached to database.createEventHandle
(String eventName, EventHandler eventHandler) Creates an event handle for this database type.createStatement
(FbTransaction transaction) Creates a statement associated with a transactionCreates a transaction parameter buffer that is usable withstartTransaction(org.firebirdsql.gds.TransactionParameterBuffer)
.void
Drops (and deletes) the currently attached database.void
executeImmediate
(String statementText, FbTransaction transaction) Performs an execute immediate of a statement.short
short
byte[]
getDatabaseInfo
(byte[] requestItems, int maxBufferLength) Performs a database info request.<T> T
getDatabaseInfo
(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) Request database info.int
int
int
default OdsVersion
void
queueEvent
(EventHandle eventHandle) Queues a wait for an event.reconnectTransaction
(long transactionId) Reconnects a prepared transaction.void
removeDatabaseListener
(DatabaseListener listener) Removes aDatabaseListener
instance from this database.startTransaction
(String statementText) Creates and starts a transaction using a SQL statementCreates and starts a transaction.Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListener
Methods inherited from interface org.firebirdsql.gds.ng.FbAttachment
attach, close, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getNetworkTimeout, getServerVersion, isAttached, isLockedByCurrentThread, setNetworkTimeout, withLock
-
Method Details
-
createDatabase
Creates a new database, connection remains attached to database.- Throws:
SQLException
-
dropDatabase
Drops (and deletes) the currently attached database.- Throws:
SQLException
-
cancelOperation
Cancels 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!
- Parameters:
kind
- Cancellation type- Throws:
SQLException
- For errors cancelling, or if the cancel operation is not supported.
-
startTransaction
Creates and starts a transaction.- Parameters:
tpb
- TransactionParameterBuffer with the required transaction options- Returns:
- FbTransaction
- Throws:
SQLException
-
startTransaction
Creates and starts a transaction using a SQL statement- Parameters:
statementText
- statement which starts a transaction- Returns:
- FbTransaction
- Throws:
SQLException
- for database access error- Since:
- 6
-
reconnectTransaction
Reconnects a prepared transaction.Reconnecting transactions is only allowed for transactions in limbo (prepared, but not committed or rolled back).
- Parameters:
transactionId
- The id of the transaction to reconnect.- Returns:
- FbTransaction
- Throws:
SQLException
- For errors reconnecting the transaction
-
createStatement
Creates a statement associated with a transaction- Parameters:
transaction
- FbTransaction to associate with this statement (can benull
)- Returns:
- FbStatement
- Throws:
SQLException
-
createBlobForOutput
Creates a blob for write access to a new blob on the server.The blob is initially closed.
- Parameters:
transaction
- transaction associated with the blobblobParameterBuffer
- blob parameter buffer- Returns:
- instance of
FbBlob
-
createBlobForOutput
Creates a blob for write access to a new blob on the server.The blob is initially closed.
Equivalent to calling
createBlobForOutput(FbTransaction, BlobParameterBuffer)
withnull
forblobParameterBuffer
.- Parameters:
transaction
- transaction associated with the blob- Returns:
- instance of
FbBlob
- Since:
- 5
-
createBlobForOutput
Creates a blob for write access to a new blob on the server.The blob is initially closed.
- Parameters:
transaction
- transaction associated with the blobblobConfig
- blob config (cannot benull
)- Returns:
- instance of
FbBlob
- Since:
- 5
-
createBlobForInput
FbBlob createBlobForInput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId) Creates a blob for read access to an existing blob on the server.The blob is initially closed.
- Parameters:
transaction
- transaction associated with the blobblobParameterBuffer
- blob parameter bufferblobId
- id of the blob- Returns:
- instance of
FbBlob
-
createBlobForInput
Creates a blob for read access to an existing blob on the server.The blob is initially closed.
Equivalent to calling
createBlobForInput(FbTransaction, BlobParameterBuffer, long)
withnull
forblobParameterBuffer
.- Parameters:
transaction
- transaction associated with the blobblobId
- id of the blob- Returns:
- instance of
FbBlob
- Since:
- 5
-
createBlobForInput
Creates a blob for read access to an existing blob on the server.The blob is initially closed.
- Parameters:
transaction
- transaction associated with the blobblobConfig
- blob config (cannot benull
)blobId
- handle id of the blob- Returns:
- instance of
FbBlob
- Since:
- 5
-
createBlobParameterBuffer
BlobParameterBuffer createBlobParameterBuffer()Creates a blob parameter buffer that is usable withcreateBlobForInput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer, long)
andcreateBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer)
of this instance.- Returns:
- A blob parameter buffer.
-
createTransactionParameterBuffer
TransactionParameterBuffer createTransactionParameterBuffer()Creates a transaction parameter buffer that is usable withstartTransaction(org.firebirdsql.gds.TransactionParameterBuffer)
.- Returns:
- A transaction parameter buffer
-
getDatabaseInfo
<T> T getDatabaseInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) throws SQLException Request database info.- Parameters:
requestItems
- Array of info items to requestbufferLength
- Response buffer length to useinfoProcessor
- Implementation ofInfoProcessor
to transform the info response- Returns:
- Transformed info response of type T
- Throws:
SQLException
- For errors retrieving or transforming the response.
-
getDatabaseInfo
Performs a database info request.- Parameters:
requestItems
- Information items to requestmaxBufferLength
- Maximum response buffer length to use- Returns:
- The response buffer (note: length is the actual length of the response, not
maxBufferLength
- Throws:
SQLException
- For errors retrieving the information.
-
executeImmediate
Performs an execute immediate of a statement.A call to this method is the equivalent of a
isc_dsql_execute_immediate()
without parameters.- Parameters:
statementText
- Statement texttransaction
- Transaction (null
only allowed if database is not attached!)- Throws:
SQLException
- For errors executing the statement, or iftransaction
isnull
when the database is attached or notnull
when the database is not attached
-
getDatabaseDialect
short getDatabaseDialect()- Returns:
- The database dialect
-
getConnectionDialect
short getConnectionDialect()- Returns:
- The client connection dialect
-
getHandle
int getHandle()- Specified by:
getHandle
in interfaceFbAttachment
- Returns:
- The database handle value
-
getOdsMajor
int getOdsMajor()- Returns:
- ODS major version
-
getOdsMinor
int getOdsMinor()- Returns:
- ODS minor version
-
getOdsVersion
- Returns:
- ODS version
- Since:
- 6
-
addDatabaseListener
Adds aDatabaseListener
instance to this database.- Parameters:
listener
- Database listener
-
addWeakDatabaseListener
Adds aDatabaseListener
instance to this database using a weak reference.If the listener is already strongly referenced, this call will be ignored
- Parameters:
listener
- Database listener
-
removeDatabaseListener
Removes aDatabaseListener
instance from this database.- Parameters:
listener
- Database Listener
-
createEventHandle
Creates an event handle for this database type.The returned event handle can be used with
queueEvent(org.firebirdsql.gds.EventHandle)
.- Parameters:
eventName
- Name of the eventeventHandler
- The event handler to call when the event occurred- Returns:
- A suitable event handle instance
- Throws:
SQLException
- For errors creating the event handle
-
countEvents
Counts the events occurred.- Parameters:
eventHandle
- The event handle- Throws:
SQLException
- When the count can not be done (as - for example - the event handle is of the wrong type)
-
queueEvent
Queues a wait for an event.- Parameters:
eventHandle
- The event handle (created usingcreateEventHandle(String, EventHandler)
of this instance).- Throws:
SQLException
- For errors establishing the asynchronous channel, or for queuing the event.
-
cancelEvent
Cancels a registered event.After cancellation, the event handle should be considered unusable. Before queueing a new event, an new handle needs to be created.
- Parameters:
eventHandle
- The event handle to cancel- Throws:
SQLException
- For errors cancelling the event
-
getConnectionProperties
IConnectionProperties getConnectionProperties()- Returns:
- An immutable copy of the connection properties of this database
-
emptyRowDescriptor
RowDescriptor emptyRowDescriptor()- Returns:
- A potentially cached empty row descriptor for this database.
-