public interface FbDatabase extends FbAttachment
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.
Modifier and Type | Method and Description |
---|---|
void |
addDatabaseListener(DatabaseListener listener)
Adds a
DatabaseListener instance to this database. |
void |
addWeakDatabaseListener(DatabaseListener listener)
Adds a
DatabaseListener 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.
|
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.
|
BlobParameterBuffer |
createBlobParameterBuffer()
Creates a blob parameter buffer that is usable with
createBlobForInput(FbTransaction,
org.firebirdsql.gds.BlobParameterBuffer, long)
and createBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer) of this instance. |
void |
createDatabase()
Creates a new database, connection remains attached to database.
|
EventHandle |
createEventHandle(java.lang.String eventName,
EventHandler eventHandler)
Creates an event handle for this database type.
|
FbStatement |
createStatement(FbTransaction transaction)
Creates a statement associated with a transaction
|
TransactionParameterBuffer |
createTransactionParameterBuffer()
Creates a transaction parameter buffer that is usable with
startTransaction(org.firebirdsql.gds.TransactionParameterBuffer) . |
void |
dropDatabase()
Drops (and deletes) the currently attached database.
|
RowDescriptor |
emptyRowDescriptor() |
void |
executeImmediate(java.lang.String statementText,
FbTransaction transaction)
Performs an execute immediate of a statement.
|
short |
getConnectionDialect() |
IConnectionProperties |
getConnectionProperties() |
short |
getDatabaseDialect() |
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 |
getHandle() |
int |
getOdsMajor() |
int |
getOdsMinor() |
void |
queueEvent(EventHandle eventHandle)
Queues a wait for an event.
|
FbTransaction |
reconnectTransaction(long transactionId)
Reconnects a prepared transaction.
|
void |
removeDatabaseListener(DatabaseListener listener)
Removes a
DatabaseListener instance from this database. |
FbTransaction |
startTransaction(TransactionParameterBuffer tpb)
Creates and starts a transaction.
|
attach, close, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, getSynchronizationObject, isAttached
addExceptionListener, removeExceptionListener
void createDatabase() throws java.sql.SQLException
java.sql.SQLException
void dropDatabase() throws java.sql.SQLException
java.sql.SQLException
void cancelOperation(int kind) throws java.sql.SQLException
The cancellation types are:
ISCConstants.fb_cancel_disable
ISCConstants.fb_cancel_enable
ISCConstants.fb_cancel_raise
ISCConstants.fb_cancel_abort
kind
- Cancellation typejava.sql.SQLException
- For errors cancelling, or if the cancel operation is not supported.FbTransaction startTransaction(TransactionParameterBuffer tpb) throws java.sql.SQLException
tpb
- TransactionParameterBuffer with the required transaction
optionsjava.sql.SQLException
FbTransaction reconnectTransaction(long transactionId) throws java.sql.SQLException
Reconnecting transactions is only allowed for transactions in limbo (prepared, but not committed or rolled back).
transactionId
- The id of the transaction to reconnect.java.sql.SQLException
- For errors reconnecting the transactionFbStatement createStatement(FbTransaction transaction) throws java.sql.SQLException
transaction
- FbTransaction to associate with this statement (can be null
).java.sql.SQLException
FbBlob createBlobForOutput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer)
The blob is initially closed.
transaction
- Transaction associated with the blob.blobParameterBuffer
- Blob Parameter BufferFbBlob
FbBlob createBlobForInput(FbTransaction transaction, BlobParameterBuffer blobParameterBuffer, long blobId)
The blob is initially closed.
transaction
- Transaction associated with the blob.blobParameterBuffer
- Blob Parameter BufferblobId
- Handle id of the blobFbBlob
BlobParameterBuffer createBlobParameterBuffer()
createBlobForInput(FbTransaction,
org.firebirdsql.gds.BlobParameterBuffer, long)
and createBlobForOutput(FbTransaction, org.firebirdsql.gds.BlobParameterBuffer)
of this instance.TransactionParameterBuffer createTransactionParameterBuffer()
startTransaction(org.firebirdsql.gds.TransactionParameterBuffer)
.<T> T getDatabaseInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) throws java.sql.SQLException
requestItems
- Array of info items to requestbufferLength
- Response buffer length to useinfoProcessor
- Implementation of InfoProcessor
to transform
the info responsejava.sql.SQLException
- For errors retrieving or transforming the response.byte[] getDatabaseInfo(byte[] requestItems, int maxBufferLength) throws java.sql.SQLException
requestItems
- Information items to requestmaxBufferLength
- Maximum response buffer length to usemaxBufferLength
java.sql.SQLException
- For errors retrieving the information.void executeImmediate(java.lang.String statementText, FbTransaction transaction) throws java.sql.SQLException
A call to this method is the equivalent of a isc_dsql_execute_immediate()
without parameters.
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 attachedshort getDatabaseDialect()
short getConnectionDialect()
int getHandle()
getHandle
in interface FbAttachment
int getOdsMajor()
int getOdsMinor()
void addDatabaseListener(DatabaseListener listener)
DatabaseListener
instance to this database.listener
- Database listenervoid addWeakDatabaseListener(DatabaseListener listener)
DatabaseListener
instance to this database using a weak reference.
If the listener is already strongly referenced, this call will be ignored
listener
- Database listenervoid removeDatabaseListener(DatabaseListener listener)
DatabaseListener
instance from this database.listener
- Database ListenerEventHandle createEventHandle(java.lang.String eventName, EventHandler eventHandler) throws java.sql.SQLException
The returned event handle can be used with queueEvent(org.firebirdsql.gds.EventHandle)
.
eventName
- Name of the eventeventHandler
- The event handler to call when the event occurredjava.sql.SQLException
- For errors creating the event handlevoid countEvents(EventHandle eventHandle) throws java.sql.SQLException
eventHandle
- The event handlejava.sql.SQLException
- When the count can not be done (as - for example - the event handle is of the wrong type)void queueEvent(EventHandle eventHandle) throws java.sql.SQLException
eventHandle
- The event handle (created using createEventHandle(String, EventHandler)
of this instance).java.sql.SQLException
- For errors establishing the asynchronous channel, or for queuing the event.void cancelEvent(EventHandle eventHandle) throws java.sql.SQLException
After cancellation, the event handle should be considered unusable. Before queueing a new event, an new handle needs to be created.
eventHandle
- The event handle to canceljava.sql.SQLException
- For errors cancelling the eventIConnectionProperties getConnectionProperties()
RowDescriptor emptyRowDescriptor()
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.