java.lang.Object
org.firebirdsql.gds.ng.AbstractFbAttachment<T>
org.firebirdsql.gds.ng.AbstractFbDatabase<JnaDatabaseConnection>
org.firebirdsql.gds.ng.jna.JnaDatabase
- All Implemented Interfaces:
AutoCloseable,org.firebirdsql.gds.ng.FbAttachment,org.firebirdsql.gds.ng.FbDatabase,FbClientFeatureAccess,JnaAttachment,org.firebirdsql.gds.ng.listeners.ExceptionListenable,org.firebirdsql.gds.ng.listeners.TransactionListener
public class JnaDatabase
extends org.firebirdsql.gds.ng.AbstractFbDatabase<JnaDatabaseConnection>
implements JnaAttachment, org.firebirdsql.gds.ng.listeners.TransactionListener, FbClientFeatureAccess
Implementation of
FbDatabase for native client access.- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.sun.jna.ptr.IntByReferencestatic final intstatic final intprotected final ISC_STATUS[]Fields inherited from class org.firebirdsql.gds.ng.AbstractFbDatabase
databaseListenerDispatcherFields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
connection, exceptionListenerDispatcher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdditional tasks to execute directly after attach operation.voidattach()protected voidattachOrCreate(org.firebirdsql.gds.DatabaseParameterBuffer dpb, boolean create) voidcancelEvent(org.firebirdsql.gds.EventHandle eventHandle) voidcancelOperation(int kind) protected voidvoidcountEvents(org.firebirdsql.gds.EventHandle eventHandle) org.firebirdsql.gds.ng.FbBlobcreateBlobForInput(org.firebirdsql.gds.ng.FbTransaction transaction, org.firebirdsql.gds.BlobParameterBuffer blobParameterBuffer, long blobId) org.firebirdsql.gds.ng.FbBlobcreateBlobForOutput(org.firebirdsql.gds.ng.FbTransaction transaction, org.firebirdsql.gds.BlobParameterBuffer blobParameterBuffer) voidcreateEventHandle(String eventName, org.firebirdsql.gds.EventHandler eventHandler) createStatement(org.firebirdsql.gds.ng.FbTransaction transaction) voidvoidexecuteImmediate(String statementText, org.firebirdsql.gds.ng.FbTransaction transaction) protected final FbClientLibrarybyte[]getDatabaseInfo(byte[] requestItems, int maxBufferLength) intcom.sun.jna.ptr.IntByReferenceintbooleanhasFeature(FbClientFeature clientFeature) Checks for presence of a client feature.protected voidvoidprocessStatusVector(ISC_STATUS[] statusVector, org.firebirdsql.gds.ng.WarningMessageCallback warningMessageCallback) voidqueueEvent(org.firebirdsql.gds.EventHandle eventHandle) org.firebirdsql.gds.ng.FbTransactionreconnectTransaction(long transactionId) protected voidvoidsetNetworkTimeout(int milliseconds) org.firebirdsql.gds.ng.FbTransactionstartTransaction(String statementText) startTransaction(org.firebirdsql.gds.TransactionParameterBuffer tpb) protected JnaEventHandlevalidateEventHandle(org.firebirdsql.gds.EventHandle eventHandle) Methods inherited from class org.firebirdsql.gds.ng.AbstractFbDatabase
addDatabaseListener, addWeakDatabaseListener, close, createBlobParameterBuffer, createTransactionParameterBuffer, emptyRowDescriptor, getActiveTransactionCount, getConnectionDialect, getConnectionProperties, getDatabaseDialect, getDatabaseInfo, getDatabaseInformationProcessor, getDatabaseWarningCallback, getDescribeDatabaseInfoBlock, getOdsMajor, getOdsMinor, getOdsVersion, getParameterDescriptionInfoRequestItems, getStatementInfoRequestItems, getTransactionIdBuffer, removeDatabaseListener, setDatabaseDialect, setOdsMajor, setOdsMinor, transactionAdded, transactionStateChangedMethods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
addExceptionListener, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, isAttached, isLockedByCurrentThread, removeExceptionListener, requireNotAttached, safelyDetach, setAttached, setDetached, setServerVersion, withLockMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListenerMethods inherited from interface org.firebirdsql.gds.ng.FbAttachment
close, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, isAttached, isLockedByCurrentThread, withLockMethods inherited from interface org.firebirdsql.gds.ng.FbDatabase
createBlobForInput, createBlobForInput, createBlobForOutput, createBlobForOutputMethods inherited from interface org.firebirdsql.gds.ng.listeners.TransactionListener
transactionStateChanged
-
Field Details
-
STATUS_VECTOR_SIZE
public static final int STATUS_VECTOR_SIZE- See Also:
-
MAX_STATEMENT_LENGTH
public static final int MAX_STATEMENT_LENGTH- See Also:
-
handle
protected final com.sun.jna.ptr.IntByReference handle -
statusVector
-
-
Constructor Details
-
JnaDatabase
-
-
Method Details
-
getClientLibrary
- Returns:
- The client library instance associated with the database.
-
setDetachedJna
protected void setDetachedJna() -
checkConnected
- Specified by:
checkConnectedin classorg.firebirdsql.gds.ng.AbstractFbAttachment<JnaDatabaseConnection>- Throws:
SQLException
-
internalDetach
- Specified by:
internalDetachin classorg.firebirdsql.gds.ng.AbstractFbDatabase<JnaDatabaseConnection>- Throws:
SQLException
-
attach
- Specified by:
attachin interfaceorg.firebirdsql.gds.ng.FbAttachment- Throws:
SQLException
-
attachOrCreate
protected void attachOrCreate(org.firebirdsql.gds.DatabaseParameterBuffer dpb, boolean create) throws SQLException - Throws:
SQLException
-
afterAttachActions
Additional tasks to execute directly after attach operation.Implementation retrieves database information like dialect ODS and server version.
- Throws:
SQLException- For errors reading or writing database information.
-
createDatabase
- Specified by:
createDatabasein interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
dropDatabase
- Specified by:
dropDatabasein interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
cancelOperation
- Specified by:
cancelOperationin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
startTransaction
public JnaTransaction startTransaction(org.firebirdsql.gds.TransactionParameterBuffer tpb) throws SQLException - Specified by:
startTransactionin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
startTransaction
public org.firebirdsql.gds.ng.FbTransaction startTransaction(String statementText) throws SQLException - Specified by:
startTransactionin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
reconnectTransaction
public org.firebirdsql.gds.ng.FbTransaction reconnectTransaction(long transactionId) throws SQLException - Specified by:
reconnectTransactionin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
createStatement
public JnaStatement createStatement(org.firebirdsql.gds.ng.FbTransaction transaction) throws SQLException - Specified by:
createStatementin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
createBlobForOutput
public org.firebirdsql.gds.ng.FbBlob createBlobForOutput(org.firebirdsql.gds.ng.FbTransaction transaction, org.firebirdsql.gds.BlobParameterBuffer blobParameterBuffer) throws SQLException - Specified by:
createBlobForOutputin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
createBlobForInput
public org.firebirdsql.gds.ng.FbBlob createBlobForInput(org.firebirdsql.gds.ng.FbTransaction transaction, org.firebirdsql.gds.BlobParameterBuffer blobParameterBuffer, long blobId) throws SQLException - Specified by:
createBlobForInputin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
getDatabaseInfo
- Specified by:
getDatabaseInfoin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
executeImmediate
public void executeImmediate(String statementText, org.firebirdsql.gds.ng.FbTransaction transaction) throws SQLException - Specified by:
executeImmediatein interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
getHandle
public int getHandle()- Specified by:
getHandlein interfaceorg.firebirdsql.gds.ng.FbAttachment- Specified by:
getHandlein interfaceorg.firebirdsql.gds.ng.FbDatabase
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceorg.firebirdsql.gds.ng.FbAttachment- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceorg.firebirdsql.gds.ng.FbAttachment- Overrides:
getNetworkTimeoutin classorg.firebirdsql.gds.ng.AbstractFbAttachment<JnaDatabaseConnection>- Throws:
SQLException
-
getJnaHandle
public com.sun.jna.ptr.IntByReference getJnaHandle() -
validateEventHandle
protected JnaEventHandle validateEventHandle(org.firebirdsql.gds.EventHandle eventHandle) throws SQLException - Throws:
SQLException
-
createEventHandle
public JnaEventHandle createEventHandle(String eventName, org.firebirdsql.gds.EventHandler eventHandler) throws SQLException - Specified by:
createEventHandlein interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
countEvents
- Specified by:
countEventsin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
queueEvent
- Specified by:
queueEventin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
cancelEvent
- Specified by:
cancelEventin interfaceorg.firebirdsql.gds.ng.FbDatabase- Throws:
SQLException
-
processStatusVector
public void processStatusVector(ISC_STATUS[] statusVector, org.firebirdsql.gds.ng.WarningMessageCallback warningMessageCallback) throws SQLException - Throws:
SQLException
-
hasFeature
Description copied from interface:FbClientFeatureAccessChecks for presence of a client feature.- Specified by:
hasFeaturein interfaceFbClientFeatureAccess- Parameters:
clientFeature- Client feature- Returns:
trueif the feature is present,falseotherwise
-
getFeatures
- Specified by:
getFeaturesin interfaceFbClientFeatureAccess- Returns:
- an unmodifiable set with supported client features
-