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.IntByReference
static final int
static final int
protected final ISC_STATUS[]
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbDatabase
databaseListenerDispatcher
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
connection, exceptionListenerDispatcher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Additional tasks to execute directly after attach operation.void
attach()
protected void
attachOrCreate
(org.firebirdsql.gds.DatabaseParameterBuffer dpb, boolean create) void
cancelEvent
(org.firebirdsql.gds.EventHandle eventHandle) void
cancelOperation
(int kind) protected void
void
countEvents
(org.firebirdsql.gds.EventHandle eventHandle) org.firebirdsql.gds.ng.FbBlob
createBlobForInput
(org.firebirdsql.gds.ng.FbTransaction transaction, org.firebirdsql.gds.BlobParameterBuffer blobParameterBuffer, long blobId) org.firebirdsql.gds.ng.FbBlob
createBlobForOutput
(org.firebirdsql.gds.ng.FbTransaction transaction, org.firebirdsql.gds.BlobParameterBuffer blobParameterBuffer) void
createEventHandle
(String eventName, org.firebirdsql.gds.EventHandler eventHandler) createStatement
(org.firebirdsql.gds.ng.FbTransaction transaction) void
void
executeImmediate
(String statementText, org.firebirdsql.gds.ng.FbTransaction transaction) protected final FbClientLibrary
byte[]
getDatabaseInfo
(byte[] requestItems, int maxBufferLength) int
com.sun.jna.ptr.IntByReference
int
boolean
hasFeature
(FbClientFeature clientFeature) Checks for presence of a client feature.protected void
void
processStatusVector
(ISC_STATUS[] statusVector, org.firebirdsql.gds.ng.WarningMessageCallback warningMessageCallback) void
queueEvent
(org.firebirdsql.gds.EventHandle eventHandle) org.firebirdsql.gds.ng.FbTransaction
reconnectTransaction
(long transactionId) protected void
void
setNetworkTimeout
(int milliseconds) org.firebirdsql.gds.ng.FbTransaction
startTransaction
(String statementText) startTransaction
(org.firebirdsql.gds.TransactionParameterBuffer tpb) protected JnaEventHandle
validateEventHandle
(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, transactionStateChanged
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbAttachment
addExceptionListener, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, isAttached, isLockedByCurrentThread, removeExceptionListener, requireNotAttached, safelyDetach, setAttached, setDetached, setServerVersion, withLock
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListener
Methods inherited from interface org.firebirdsql.gds.ng.FbAttachment
close, forceClose, getDatatypeCoder, getEncoding, getEncodingFactory, getServerVersion, isAttached, isLockedByCurrentThread, withLock
Methods inherited from interface org.firebirdsql.gds.ng.FbDatabase
createBlobForInput, createBlobForInput, createBlobForOutput, createBlobForOutput
Methods 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:
checkConnected
in classorg.firebirdsql.gds.ng.AbstractFbAttachment<JnaDatabaseConnection>
- Throws:
SQLException
-
internalDetach
- Specified by:
internalDetach
in classorg.firebirdsql.gds.ng.AbstractFbDatabase<JnaDatabaseConnection>
- Throws:
SQLException
-
attach
- Specified by:
attach
in 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:
createDatabase
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
dropDatabase
- Specified by:
dropDatabase
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
cancelOperation
- Specified by:
cancelOperation
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
startTransaction
public JnaTransaction startTransaction(org.firebirdsql.gds.TransactionParameterBuffer tpb) throws SQLException - Specified by:
startTransaction
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
startTransaction
public org.firebirdsql.gds.ng.FbTransaction startTransaction(String statementText) throws SQLException - Specified by:
startTransaction
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
reconnectTransaction
public org.firebirdsql.gds.ng.FbTransaction reconnectTransaction(long transactionId) throws SQLException - Specified by:
reconnectTransaction
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
createStatement
public JnaStatement createStatement(org.firebirdsql.gds.ng.FbTransaction transaction) throws SQLException - Specified by:
createStatement
in 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) - Specified by:
createBlobForOutput
in interfaceorg.firebirdsql.gds.ng.FbDatabase
-
createBlobForInput
public org.firebirdsql.gds.ng.FbBlob createBlobForInput(org.firebirdsql.gds.ng.FbTransaction transaction, org.firebirdsql.gds.BlobParameterBuffer blobParameterBuffer, long blobId) - Specified by:
createBlobForInput
in interfaceorg.firebirdsql.gds.ng.FbDatabase
-
getDatabaseInfo
- Specified by:
getDatabaseInfo
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
executeImmediate
public void executeImmediate(String statementText, org.firebirdsql.gds.ng.FbTransaction transaction) throws SQLException - Specified by:
executeImmediate
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
getHandle
public int getHandle()- Specified by:
getHandle
in interfaceorg.firebirdsql.gds.ng.FbAttachment
- Specified by:
getHandle
in interfaceorg.firebirdsql.gds.ng.FbDatabase
-
setNetworkTimeout
- Specified by:
setNetworkTimeout
in interfaceorg.firebirdsql.gds.ng.FbAttachment
- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeout
in interfaceorg.firebirdsql.gds.ng.FbAttachment
- Overrides:
getNetworkTimeout
in 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:
createEventHandle
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
countEvents
- Specified by:
countEvents
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
queueEvent
- Specified by:
queueEvent
in interfaceorg.firebirdsql.gds.ng.FbDatabase
- Throws:
SQLException
-
cancelEvent
- Specified by:
cancelEvent
in 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:FbClientFeatureAccess
Checks for presence of a client feature.- Specified by:
hasFeature
in interfaceFbClientFeatureAccess
- Parameters:
clientFeature
- Client feature- Returns:
true
if the feature is present,false
otherwise
-
getFeatures
- Specified by:
getFeatures
in interfaceFbClientFeatureAccess
- Returns:
- an unmodifiable set with supported client features
-