org.firebirdsql.gds.impl.jni
Class BaseGDSImpl

java.lang.Object
  extended by org.firebirdsql.gds.impl.AbstractGDS
      extended by org.firebirdsql.gds.impl.jni.BaseGDSImpl
All Implemented Interfaces:
Externalizable, Serializable, GDS
Direct Known Subclasses:
JniGDSImpl

public abstract class BaseGDSImpl
extends AbstractGDS

See Also:
Serialized Form

Field Summary
protected static byte[] DESCRIBE_DATABASE_INFO_BLOCK
           
 int isc_api_handle
           
 
Constructor Summary
BaseGDSImpl()
           
BaseGDSImpl(GDSType gdsType)
           
 
Method Summary
 BlobParameterBuffer createBlobParameterBuffer()
          Create a new BlobParameterBuffer instance for setting blob parameters in the current GDS implementation.
 DatabaseParameterBuffer createDatabaseParameterBuffer()
          Create a new DatabaseParameterBuffer instance for setting database parameters in the current GDS implementation.
 EventHandle createEventHandle(String eventName)
          Create a new EventHandle specific to a given GDS implementation.
 IscBlobHandle createIscBlobHandle()
          Factory method to create a new IscBlobHandle instance specific to the implementation of this interface.
 IscDbHandle createIscDbHandle()
          Factory method to create a new IscDbHandle instance specific to the implementation of this interface.
 IscStmtHandle createIscStmtHandle()
          Factory method to create a new IscStmtHandle instance specific to the implementation of this interface.
 IscSvcHandle createIscSvcHandle()
          Factory method to create a new IscSvcHandle instance that is linked to the current GDS implemenation.
 IscTrHandle createIscTrHandle()
          Factory method to create a new IscTrHandle instance that is linked to the current GDS implementation.
 ServiceParameterBuffer createServiceParameterBuffer()
          Create a new ServiceParameterBuffer instance for setting service parameters in the current GDS implementation.
 ServiceRequestBuffer createServiceRequestBuffer(int taskIdentifier)
          Create a new ServiceRequestBuffer instance for setting service request parameters in the current GDS implementation.
protected  byte[] getByteArrayForString(String statement, String encoding)
           
protected abstract  String getServerUrl(String file_name)
           
 void getSqlCounts(IscStmtHandle stmt_handle)
          Fetch count information for a statement.
protected  byte[] getZeroTerminatedArray(byte[] stringBytes)
           
 void iscAttachDatabase(String file_name, IscDbHandle db_handle, DatabaseParameterBuffer databaseParameterBuffer)
          Attach to an existing database via a filename.
 byte[] iscBlobInfo(IscBlobHandle handle, byte[] items, int buffer_length)
          Retrieve data about an existing blob.
 void iscCancelEvents(IscDbHandle dbHandle, EventHandle eventHandle)
          Cancel event listening based on an EventHandle.
 void iscCloseBlob(IscBlobHandle blob_handle)
          Close an open blob.
 void iscCommitRetaining(IscTrHandle tr_handle)
           
 void iscCommitTransaction(IscTrHandle tr_handle)
          Commit a transaction.
 void iscCreateBlob2(IscDbHandle db_handle, IscTrHandle tr_handle, IscBlobHandle blob_handle, BlobParameterBuffer blobParameterBuffer)
          Create a new blob within a given transaction.
 void iscCreateDatabase(String file_name, IscDbHandle db_handle, DatabaseParameterBuffer databaseParameterBuffer)
          Create a database based on the supplied filename and database parameters.
 byte[] iscDatabaseInfo(IscDbHandle db_handle, byte[] items, int buffer_length)
          Get information about the database to which IscDbHandle is attached.
 void iscDetachDatabase(IscDbHandle db_handle)
          Detach the given database handle from its database.
 void iscDropDatabase(IscDbHandle db_handle)
          Drop (delete) the database to which IscDbHandle is attached.
 void iscDsqlAllocateStatement(IscDbHandle db_handle, IscStmtHandle stmt_handle)
          Allocate a dynamic SQL (DSQL) statement on the database to which IscDbHandle is attached.
 XSQLDA iscDsqlDescribe(IscStmtHandle stmt_handle, int da_version)
          Retrieve data for a statement.
 XSQLDA iscDsqlDescribeBind(IscStmtHandle stmt_handle, int da_version)
          Retrieve data for a bind statement.
 void iscDsqlExecImmed2(IscDbHandle db_handle, IscTrHandle tr_handle, byte[] statement, int dialect, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
          Execute a string SQL statement directly, without first allocating a statement handle.
 void iscDsqlExecImmed2(IscDbHandle db_handle, IscTrHandle tr_handle, String statement, int dialect, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
          Execute a string SQL statement directly, without first allocating a statement handle.
 void iscDsqlExecImmed2(IscDbHandle db_handle, IscTrHandle tr_handle, String statement, String encoding, int dialect, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
           
 void iscDsqlExecute(IscTrHandle tr_handle, IscStmtHandle stmt_handle, int da_version, XSQLDA xsqlda)
          Execute a statement with only outgoing data.
 void iscDsqlExecute2(IscTrHandle tr_handle, IscStmtHandle stmt_handle, int da_version, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
          Execute a statement with outgoing and incoming data.
 void iscDsqlExecuteImmediate(IscDbHandle db_handle, IscTrHandle tr_handle, byte[] statement, int dialect, XSQLDA xsqlda)
          Execute a string SQL statement directly, without first allocating a statement handle.
 void iscDsqlExecuteImmediate(IscDbHandle db_handle, IscTrHandle tr_handle, String statement, int dialect, XSQLDA xsqlda)
          Execute a string SQL statement directly, without first allocating a statement handle.
 void iscDsqlExecuteImmediate(IscDbHandle db_handle, IscTrHandle tr_handle, String statement, String encoding, int dialect, XSQLDA xsqlda)
           
 void iscDsqlFetch(IscStmtHandle stmt_handle, int da_version, XSQLDA xsqlda, int fetchSize)
          Retrieve record data from a statement.
 void iscDsqlFreeStatement(IscStmtHandle stmt_handle, int option)
          Free a statement in the database that is pointed to by a valid handle.
 XSQLDA iscDsqlPrepare(IscTrHandle tr_handle, IscStmtHandle stmt_handle, byte[] statement, int dialect)
          Prepare a string SQL statement for execution in the database.
 XSQLDA iscDsqlPrepare(IscTrHandle tr_handle, IscStmtHandle stmt_handle, String statement, int dialect)
          Prepare a string SQL statement for execution in the database.
 XSQLDA iscDsqlPrepare(IscTrHandle tr_handle, IscStmtHandle stmt_handle, String statement, String encoding, int dialect)
           
 void iscDsqlSetCursorName(IscStmtHandle stmt_handle, String cursor_name, int type)
          Set the name to be used for a given statement.
 byte[] iscDsqlSqlInfo(IscStmtHandle stmt_handle, byte[] items, int buffer_length)
          Retrieve data about a statement.
 void iscEventBlock(EventHandle eventHandle)
          Initialize the internal databastructures for an EventHandle.
 void iscEventCounts(EventHandle eventHandle)
          Retrieve count information after an event has occurred.
 byte[] iscExpandDpb(byte[] dpb, int dpb_length, int param, Object[] params)
           
 byte[] iscGetSegment(IscBlobHandle blob, int maxread)
          Fetch a segment of a blob.
 void iscOpenBlob2(IscDbHandle db_handle, IscTrHandle tr_handle, IscBlobHandle blob_handle, BlobParameterBuffer blobParameterBuffer)
          Open a blob within a given transaction.
 void iscPrepareTransaction(IscTrHandle tr_handle)
           
 void iscPrepareTransaction2(IscTrHandle tr_handle, byte[] bytes)
           
 void iscPutSegment(IscBlobHandle blob_handle, byte[] buffer)
          Write a segment of data to a blob.
 int iscQueueEvents(IscDbHandle dbHandle, EventHandle eventHandle, EventHandler eventHandler)
          Queue an EventHandler.
 void iscReconnectTransaction(IscTrHandle tr_handle, IscDbHandle db_handle, long transactionId)
          Reconnect "in limbo" transaction using new database handle.
 void iscRollbackRetaining(IscTrHandle tr_handle)
           
 void iscRollbackTransaction(IscTrHandle tr_handle)
          Rollback a transaction.
 void iscSeekBlob(IscBlobHandle handle, int position, int mode)
          Seek to a given position in a blob.
 void iscServiceAttach(String service, IscSvcHandle serviceHandle, ServiceParameterBuffer serviceParameterBuffer)
          Attach to a Service Manager.
 void iscServiceDetach(IscSvcHandle serviceHandle)
          Detach from a Service Manager.
 void iscServiceQuery(IscSvcHandle serviceHandle, ServiceParameterBuffer serviceParameterBuffer, ServiceRequestBuffer serviceRequestBuffer, byte[] resultBuffer)
          Query a service manager
 void iscServiceStart(IscSvcHandle serviceHandle, ServiceRequestBuffer serviceRequestBuffer)
          Start a service operation.
 void iscStartTransaction(IscTrHandle tr_handle, IscDbHandle db_handle, TransactionParameterBuffer tpb)
          Start a transaction based on a handle to a transaction.
 byte[] iscTransactionInformation(IscTrHandle trHandle, byte[] requestBuffer, int bufferLen)
           
 int iscVaxInteger(byte[] buffer, int pos, int length)
          Retrieve an integer value from a sequence of bytes.
 int iscVaxInteger2(byte[] buffer, int pos)
           
abstract  void native_isc_attach_database(byte[] file_name, IscDbHandle db_handle, byte[] dpbBytes)
           
abstract  byte[] native_isc_blob_info(isc_blob_handle_impl handle, byte[] items, int buffer_length)
           
abstract  void native_isc_cancel_events(IscDbHandle db_handle, EventHandleImp eventHandle)
           
abstract  void native_isc_close_blob(IscBlobHandle blob)
           
abstract  void native_isc_commit_retaining(IscTrHandle tr_handle)
           
abstract  void native_isc_commit_transaction(IscTrHandle tr_handle)
           
abstract  void native_isc_create_blob2(IscDbHandle db, IscTrHandle tr, IscBlobHandle blob, byte[] dpbBytes)
           
abstract  void native_isc_create_database(byte[] file_name, IscDbHandle db_handle, byte[] dpbBytes)
           
abstract  void native_isc_database_info(IscDbHandle db_handle, int item_length, byte[] items, int buffer_length, byte[] buffer)
           
abstract  void native_isc_detach_database(IscDbHandle db_handle)
           
abstract  void native_isc_drop_database(IscDbHandle db_handle)
           
abstract  void native_isc_dsql_alloc_statement2(IscDbHandle db_handle, IscStmtHandle stmt_handle)
           
abstract  void native_isc_dsql_allocate_statement(IscDbHandle db_handle, IscStmtHandle stmt_handle)
           
abstract  XSQLDA native_isc_dsql_describe_bind(IscStmtHandle stmt_handle, int da_version)
           
abstract  XSQLDA native_isc_dsql_describe(IscStmtHandle stmt_handle, int da_version)
           
abstract  void native_isc_dsql_exec_immed2(IscDbHandle db_handle, IscTrHandle tr_handle, byte[] statement, int dialect, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
           
abstract  void native_isc_dsql_execute2(IscTrHandle tr_handle, IscStmtHandle stmt_handle, int da_version, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
           
abstract  boolean native_isc_dsql_fetch(IscStmtHandle stmt_handle, int da_version, XSQLDA xsqlda, int fetchSize)
           
abstract  void native_isc_dsql_free_statement(IscStmtHandle stmt_handle, int option)
           
abstract  XSQLDA native_isc_dsql_prepare(IscTrHandle tr_handle, IscStmtHandle stmt_handle, byte[] statement, int dialect)
           
abstract  void native_isc_dsql_set_cursor_name(IscStmtHandle stmt_handle, String cursor_name, int type)
           
abstract  byte[] native_isc_dsql_sql_info(IscStmtHandle stmt_handle, byte[] items, int buffer_length)
           
abstract  long native_isc_event_block(EventHandleImp eventHandle, String eventNames)
           
abstract  void native_isc_event_counts(EventHandleImp eventHandle)
           
abstract  byte[] native_isc_get_segment(IscBlobHandle blob, int maxread)
           
abstract  void native_isc_open_blob2(IscDbHandle db, IscTrHandle tr, IscBlobHandle blob, byte[] dpbBytes)
           
abstract  void native_isc_prepare_transaction(IscTrHandle tr_handle)
           
abstract  void native_isc_prepare_transaction2(IscTrHandle tr_handle, byte[] bytes)
           
abstract  void native_isc_put_segment(IscBlobHandle blob_handle, byte[] buffer)
           
abstract  int native_isc_que_events(IscDbHandle db_handle, EventHandleImp eventHandle, EventHandler handler)
           
abstract  void native_isc_reconnect_transaction(IscDbHandle dbHandle, IscTrHandle trHandle, byte[] txId)
           
abstract  void native_isc_rollback_retaining(IscTrHandle tr_handle)
           
abstract  void native_isc_rollback_transaction(IscTrHandle tr_handle)
           
abstract  void native_isc_seek_blob(isc_blob_handle_impl handle, int position, int mode)
           
abstract  void native_isc_service_attach(String service, IscSvcHandle serviceHandle, byte[] serviceParameterBuffer)
           
abstract  void native_isc_service_detach(IscSvcHandle serviceHandle)
           
abstract  void native_isc_service_query(IscSvcHandle serviceHandle, byte[] sendServiceParameterBuffer, byte[] requestServiceParameterBuffer, byte[] resultBuffer)
           
abstract  void native_isc_service_start(IscSvcHandle serviceHandle, byte[] serviceParameterBuffer)
           
abstract  void native_isc_start_transaction(IscTrHandle tr_handle, IscDbHandle db_handle, byte[] tpb)
           
abstract  byte[] native_isc_transaction_info(IscTrHandle tr_handle, byte[] items, int bufferSize)
           
 TransactionParameterBuffer newTransactionParameterBuffer()
          Create new TransactionParameterBuffer instance for setting transaction parameters in the current GDS implementation.
 void readSQLData(XSQLDA xsqlda, isc_stmt_handle_impl stmt)
           
 
Methods inherited from class org.firebirdsql.gds.impl.AbstractGDS
close, getGdsType, getType, readExternal, readResolve, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIBE_DATABASE_INFO_BLOCK

protected static final byte[] DESCRIBE_DATABASE_INFO_BLOCK

isc_api_handle

public int isc_api_handle
Constructor Detail

BaseGDSImpl

public BaseGDSImpl()

BaseGDSImpl

public BaseGDSImpl(GDSType gdsType)
Method Detail

getServerUrl

protected abstract String getServerUrl(String file_name)
                                throws GDSException
Throws:
GDSException

createBlobParameterBuffer

public BlobParameterBuffer createBlobParameterBuffer()
Description copied from interface: GDS
Create a new BlobParameterBuffer instance for setting blob parameters in the current GDS implementation.

Returns:
A new BlobParameterBuffer

createDatabaseParameterBuffer

public DatabaseParameterBuffer createDatabaseParameterBuffer()
Description copied from interface: GDS
Create a new DatabaseParameterBuffer instance for setting database parameters in the current GDS implementation.

Returns:
A new DatabaseParameterBuffer

createIscBlobHandle

public IscBlobHandle createIscBlobHandle()
Description copied from interface: GDS
Factory method to create a new IscBlobHandle instance specific to the implementation of this interface.

Returns:
A new IscBlobHandle instance

createIscDbHandle

public IscDbHandle createIscDbHandle()
Description copied from interface: GDS
Factory method to create a new IscDbHandle instance specific to the implementation of this interface.

Returns:
instance of IscDbHandle

createIscStmtHandle

public IscStmtHandle createIscStmtHandle()
Description copied from interface: GDS
Factory method to create a new IscStmtHandle instance specific to the implementation of this interface.

Returns:
A new IscStmtHandle instance

createIscSvcHandle

public IscSvcHandle createIscSvcHandle()
Description copied from interface: GDS
Factory method to create a new IscSvcHandle instance that is linked to the current GDS implemenation.

Returns:
A new IscSvcHandle instance

createIscTrHandle

public IscTrHandle createIscTrHandle()
Description copied from interface: GDS
Factory method to create a new IscTrHandle instance that is linked to the current GDS implementation.

Returns:
A new IscTrHandle instance

createServiceParameterBuffer

public ServiceParameterBuffer createServiceParameterBuffer()
Description copied from interface: GDS
Create a new ServiceParameterBuffer instance for setting service parameters in the current GDS implementation.

Returns:
a new ServiceParameterBuffer

createServiceRequestBuffer

public ServiceRequestBuffer createServiceRequestBuffer(int taskIdentifier)
Description copied from interface: GDS
Create a new ServiceRequestBuffer instance for setting service request parameters in the current GDS implementation. The returned ServiceRequestBuffer is linked to a specific Services API task, and must be one of the isc_info_svc_* or isc_action_svc constants from ISCConstants.

Parameters:
taskIdentifier - The specific Services API task for which the ServiceRequestBuffer is created
Returns:
A new ServiceRequestBuffer

iscAttachDatabase

public void iscAttachDatabase(String file_name,
                              IscDbHandle db_handle,
                              DatabaseParameterBuffer databaseParameterBuffer)
                       throws GDSException
Description copied from interface: GDS
Attach to an existing database via a filename.

Parameters:
file_name - The filename for the database, including host and port. The expected format is <host name>/<port>:<file path>. The value for host is localhost if not supplied. The value for port is 3050 if not supplied.
db_handle - The handle to attach to the database
databaseParameterBuffer - parameters for the database attachment
Throws:
GDSException - if an error occurs while attaching to the database

iscBlobInfo

public byte[] iscBlobInfo(IscBlobHandle handle,
                          byte[] items,
                          int buffer_length)
                   throws GDSException
Description copied from interface: GDS
Retrieve data about an existing blob. The parameters to be retrieved are placed in items, and the corresponding values are returned. The values in items should be isc_info_blob_* constants from ISCConstants.

Parameters:
handle - Handle to the blob for which data is to be retrieved
items - Parameters to be fetched about the blob
buffer_length - Length of the byte array to be returned
Returns:
Data corresponding to the parameters requested in items
Throws:
GDSException - if an error occurs while fetching data about the blob

iscCloseBlob

public void iscCloseBlob(IscBlobHandle blob_handle)
                  throws GDSException
Description copied from interface: GDS
Close an open blob.

Parameters:
blob_handle - Handle to the blob to be closed
Throws:
GDSException - if an error occurs while closing the blob

iscCommitRetaining

public void iscCommitRetaining(IscTrHandle tr_handle)
                        throws GDSException
Throws:
GDSException

iscCommitTransaction

public void iscCommitTransaction(IscTrHandle tr_handle)
                          throws GDSException
Description copied from interface: GDS
Commit a transaction.

Parameters:
tr_handle - Handle to the transaction to be committed.
Throws:
GDSException - if an error occurs while committing the transaction
See Also:
GDS.iscRollbackTransaction(IscTrHandle)

iscCreateBlob2

public void iscCreateBlob2(IscDbHandle db_handle,
                           IscTrHandle tr_handle,
                           IscBlobHandle blob_handle,
                           BlobParameterBuffer blobParameterBuffer)
                    throws GDSException
Description copied from interface: GDS
Create a new blob within a given transaction.

Parameters:
db_handle - Handle to the database in which the blob will be created
tr_handle - Handle to the transaction in which the blob will be created
blob_handle - Handle to be attached to the newly created blob
blobParameterBuffer - contains parameters for creation of the new blob, can be null
Throws:
GDSException - if an error occurs while creating the blob

iscCreateDatabase

public void iscCreateDatabase(String file_name,
                              IscDbHandle db_handle,
                              DatabaseParameterBuffer databaseParameterBuffer)
                       throws GDSException
Description copied from interface: GDS
Create a database based on the supplied filename and database parameters. The supplied IscDbHandle is attached to the newly created database.

Parameters:
file_name - The filename for the new database, including host and port. The expected format is host:port:filepath. The value for host is localhost if not supplied. The value for port is 3050 if not supplied.
db_handle - The handle to attach to the new database
databaseParameterBuffer - The parameters for the new database and attachment to it
Throws:
GDSException - if an error occurs while creating the database

iscDatabaseInfo

public byte[] iscDatabaseInfo(IscDbHandle db_handle,
                              byte[] items,
                              int buffer_length)
                       throws GDSException
Description copied from interface: GDS
Get information about the database to which IscDbHandle is attached. The requested parameters are values set in items, and the values in the returned byte-array correspond to the requested parameters in items

Parameters:
db_handle - Handle to the database for which info is to be retrieved
items - An array of values from the isc_info_* constant fields from ISCConstants
buffer_length - The size of the byte array that is to be returned
Returns:
array of bytes whose values correspond the requested parameters in items
Throws:
GDSException - if an error occurs while retrieving database info

iscDetachDatabase

public void iscDetachDatabase(IscDbHandle db_handle)
                       throws GDSException
Description copied from interface: GDS
Detach the given database handle from its database. This effectively closes the connection to the database.

Parameters:
db_handle - The handle to be detached
Throws:
GDSException - if an error occurs while detaching from the database

iscDropDatabase

public void iscDropDatabase(IscDbHandle db_handle)
                     throws GDSException
Description copied from interface: GDS
Drop (delete) the database to which IscDbHandle is attached.

Parameters:
db_handle - Handle to the database to be dropped
Throws:
GDSException - if an error occurs while dropping the database

iscDsqlAllocateStatement

public void iscDsqlAllocateStatement(IscDbHandle db_handle,
                                     IscStmtHandle stmt_handle)
                              throws GDSException
Description copied from interface: GDS
Allocate a dynamic SQL (DSQL) statement on the database to which IscDbHandle is attached.

Parameters:
db_handle - Handle to the database where the statement is to be allocated
stmt_handle - Handle to attach to the newly allocated statement
Throws:
GDSException - if an error occurs while allocating the statement

iscDsqlDescribe

public XSQLDA iscDsqlDescribe(IscStmtHandle stmt_handle,
                              int da_version)
                       throws GDSException
Description copied from interface: GDS
Retrieve data for a statement.

Parameters:
stmt_handle - Handle to the statement about which data is to be retrieved
da_version - Version of the XSQLDA to be retrieved
Returns:
data for the given statement
Throws:
GDSException - if an error occurs while retrieving statement data

iscDsqlDescribeBind

public XSQLDA iscDsqlDescribeBind(IscStmtHandle stmt_handle,
                                  int da_version)
                           throws GDSException
Description copied from interface: GDS
Retrieve data for a bind statement.

Parameters:
stmt_handle - Handle to the bind statement about which bind data is to be retrieved
da_version - Version of the XSQLDA to be retrieved
Returns:
data for the given bind statement
Throws:
GDSException - if an error occurs while retrieving statement data

iscDsqlExecImmed2

public void iscDsqlExecImmed2(IscDbHandle db_handle,
                              IscTrHandle tr_handle,
                              byte[] statement,
                              int dialect,
                              XSQLDA in_xsqlda,
                              XSQLDA out_xsqlda)
                       throws GDSException
Description copied from interface: GDS
Execute a string SQL statement directly, without first allocating a statement handle. Output data from executing the statement is stored in outXSQLDA.

Parameters:
db_handle - Handle to the database where the statement is to be executed
tr_handle - Handle to the transaction in which the statement is to be executed
statement - byte array holding the SQL to be executed
dialect - Interbase dialect for the SQL, should be one of the SQL_DIALECT_* constants from ISCConstants
in_xsqlda - Data to be sent to the database for the statement
out_xsqlda - Holder for data retrieved from the database
Throws:
GDSException - if an error occurs while executing the statement

iscDsqlExecImmed2

public void iscDsqlExecImmed2(IscDbHandle db_handle,
                              IscTrHandle tr_handle,
                              String statement,
                              int dialect,
                              XSQLDA in_xsqlda,
                              XSQLDA out_xsqlda)
                       throws GDSException
Description copied from interface: GDS
Execute a string SQL statement directly, without first allocating a statement handle. Data is retrieved using this method.

Parameters:
db_handle - Handle to the database where the statement is to be executed
tr_handle - Handle to the transaction in which the statement is to be executed
statement - byte array holding the SQL to be executed
dialect - Interbase dialect for the SQL, should be one of the SQL_DIALECT_* constants from ISCConstants
in_xsqlda - Data to be sent to the database for the statement
out_xsqlda - Placeholder for data retrieved from executing the SQL statement
Throws:
GDSException - if an error occurs while executing the statement

iscDsqlExecImmed2

public void iscDsqlExecImmed2(IscDbHandle db_handle,
                              IscTrHandle tr_handle,
                              String statement,
                              String encoding,
                              int dialect,
                              XSQLDA in_xsqlda,
                              XSQLDA out_xsqlda)
                       throws GDSException
Throws:
GDSException

iscDsqlExecute

public void iscDsqlExecute(IscTrHandle tr_handle,
                           IscStmtHandle stmt_handle,
                           int da_version,
                           XSQLDA xsqlda)
                    throws GDSException
Description copied from interface: GDS
Execute a statement with only outgoing data.

Parameters:
tr_handle - Handle to the transaction in which the statement is to be executed
stmt_handle - Handle to the statement to be executed
da_version - Version of XSQLDA to be used
xsqlda - Input data for executing the statement
Throws:
GDSException - if an error occurs while executing the statement

iscDsqlExecute2

public void iscDsqlExecute2(IscTrHandle tr_handle,
                            IscStmtHandle stmt_handle,
                            int da_version,
                            XSQLDA in_xsqlda,
                            XSQLDA out_xsqlda)
                     throws GDSException
Description copied from interface: GDS
Execute a statement with outgoing and incoming data.

Parameters:
tr_handle - Handle to the transaction in which the statement is to be executed
stmt_handle - Handle to the statement to be executed
da_version - Version of XSQLDA to be used
in_xsqlda - Data to be sent to the database for the statement
out_xsqlda - Holder for data to be received from executing the statement
Throws:
GDSException - if an error occurs while executing the statement

iscDsqlExecuteImmediate

public void iscDsqlExecuteImmediate(IscDbHandle db_handle,
                                    IscTrHandle tr_handle,
                                    byte[] statement,
                                    int dialect,
                                    XSQLDA xsqlda)
                             throws GDSException
Description copied from interface: GDS
Execute a string SQL statement directly, without first allocating a statement handle. No data is retrieved using this method.

Parameters:
db_handle - Handle to the database where the statement is to be executed
tr_handle - Handle to the transaction in which the statement is to be executed
statement - byte array holding the SQL to be executed
dialect - Interbase dialect for the SQL, should be one of the SQL_DIALECT_* constants from ISCConstants
xsqlda - Data to be sent to the database for the statement
Throws:
GDSException - if an error occurs while executing the statement

iscDsqlExecuteImmediate

public void iscDsqlExecuteImmediate(IscDbHandle db_handle,
                                    IscTrHandle tr_handle,
                                    String statement,
                                    int dialect,
                                    XSQLDA xsqlda)
                             throws GDSException
Description copied from interface: GDS
Execute a string SQL statement directly, without first allocating a statement handle. No data is retrieved using this method.

Parameters:
db_handle - Handle to the database where the statement is to be executed
tr_handle - Handle to the transaction in which the statement is to be executed
statement - SQL command to be executed
dialect - Interbase dialect for the SQL, should be one of the SQL_DIALECT_* constants from ISCConstants
xsqlda - Data to be sent to the database for the statement
Throws:
GDSException - if an error occurs while executing the statement

iscDsqlExecuteImmediate

public void iscDsqlExecuteImmediate(IscDbHandle db_handle,
                                    IscTrHandle tr_handle,
                                    String statement,
                                    String encoding,
                                    int dialect,
                                    XSQLDA xsqlda)
                             throws GDSException
Throws:
GDSException

iscDsqlFetch

public void iscDsqlFetch(IscStmtHandle stmt_handle,
                         int da_version,
                         XSQLDA xsqlda,
                         int fetchSize)
                  throws GDSException
Description copied from interface: GDS
Retrieve record data from a statement. A maximum of fetchSize records will be fetched.

Parameters:
stmt_handle - Handle to the statement for which records are to be fetched
da_version - Version of XSQLDA to be used
xsqlda - Holder for records that are fetched
fetchSize - The maximum number of records to be fetched
Throws:
GDSException - if an error occurs while fetching the records

iscDsqlFreeStatement

public void iscDsqlFreeStatement(IscStmtHandle stmt_handle,
                                 int option)
                          throws GDSException
Description copied from interface: GDS
Free a statement in the database that is pointed to by a valid handle. The statement can be closed or fully deallocated, depending on the value of option. option should be one of ISCConstants.DSQL_drop or ISCConstants.DSQL_close.

Parameters:
stmt_handle - Handle to the statement to be freed
option - Option to be used when freeing the statement. If the value is ISCConstants.DSQL_drop, the statement will be deallocated, if the value is ISCConstants.DSQL_close, the statement will only be closed
Throws:
GDSException

iscDsqlPrepare

public XSQLDA iscDsqlPrepare(IscTrHandle tr_handle,
                             IscStmtHandle stmt_handle,
                             byte[] statement,
                             int dialect)
                      throws GDSException
Description copied from interface: GDS
Prepare a string SQL statement for execution in the database.

Parameters:
tr_handle - Handle to the transaction in which the SQL statement is to be prepared
stmt_handle - Handle to the statement for which the SQL is to be prepared
statement - byte-array with containing the SQL to be prepared
dialect - Interbase dialect for the SQL, should be one of the SQL_DIALECT_* constants from ISCConstants
Returns:
A datastructure with data about the prepared statement
Throws:
GDSException - if an error occurs while preparing the SQL

iscDsqlPrepare

public XSQLDA iscDsqlPrepare(IscTrHandle tr_handle,
                             IscStmtHandle stmt_handle,
                             String statement,
                             int dialect)
                      throws GDSException
Description copied from interface: GDS
Prepare a string SQL statement for execution in the database.

Parameters:
tr_handle - Handle to the transaction in which the SQL statement is to be prepared
stmt_handle - Handle to the statement for which the SQL is to be prepared
statement - The SQL statement to be prepared
dialect - Interbase dialect for the SQL, should be one of the SQL_DIALECT_* constants from ISCConstants
Returns:
A datastructure with data about the prepared statement
Throws:
GDSException - if an error occurs while preparing the SQL

iscDsqlPrepare

public XSQLDA iscDsqlPrepare(IscTrHandle tr_handle,
                             IscStmtHandle stmt_handle,
                             String statement,
                             String encoding,
                             int dialect)
                      throws GDSException
Throws:
GDSException

iscDsqlSetCursorName

public void iscDsqlSetCursorName(IscStmtHandle stmt_handle,
                                 String cursor_name,
                                 int type)
                          throws GDSException
Description copied from interface: GDS
Set the name to be used for a given statement.

Parameters:
stmt_handle - Handle to the statement for which the cursor name is to be set
cursor_name - Name to set for the cursor
type - Reserved for future use
Throws:
GDSException - if an error occurs while setting the cursor name

iscDsqlSqlInfo

public byte[] iscDsqlSqlInfo(IscStmtHandle stmt_handle,
                             byte[] items,
                             int buffer_length)
                      throws GDSException
Description copied from interface: GDS
Retrieve data about a statement. The parameters that are requested are defined by the isc_info_sql_* constants defined in ISCConstants. An array with corresponding values for the requested parameters is returned.

Parameters:
stmt_handle - Handle to the statement about which data is to be retrieved
items - Array of parameters whose values are to be retrieved
buffer_length - The length of the byte-array to be returned
Returns:
An array of values corresponding to the requested parameters
Throws:
GDSException - if an error occurs while retrieving the statement info

iscExpandDpb

public byte[] iscExpandDpb(byte[] dpb,
                           int dpb_length,
                           int param,
                           Object[] params)
                    throws GDSException
Throws:
GDSException

iscGetSegment

public byte[] iscGetSegment(IscBlobHandle blob,
                            int maxread)
                     throws GDSException
Description copied from interface: GDS
Fetch a segment of a blob.

Parameters:
blob - Handle to the blob from which a segment is to be fetched
maxread - The maximum number of bytes to attempt to fetch
Returns:
A segment of data from the blob, with maximum length of maxread
Throws:
GDSException - if an error occurs while fetching the blob segment

iscOpenBlob2

public void iscOpenBlob2(IscDbHandle db_handle,
                         IscTrHandle tr_handle,
                         IscBlobHandle blob_handle,
                         BlobParameterBuffer blobParameterBuffer)
                  throws GDSException
Description copied from interface: GDS
Open a blob within a given transaction.

Parameters:
db_handle - Handle to the database in which the blob will be opened
tr_handle - Handle to the transaction in which the blob will be opened
blob_handle - Handle to the blob to be opened
blobParameterBuffer - Contains parameters for the blob
Throws:
GDSException - if an error occurs while opening the blob

iscPrepareTransaction

public void iscPrepareTransaction(IscTrHandle tr_handle)
                           throws GDSException
Throws:
GDSException

iscPrepareTransaction2

public void iscPrepareTransaction2(IscTrHandle tr_handle,
                                   byte[] bytes)
                            throws GDSException
Throws:
GDSException

iscPutSegment

public void iscPutSegment(IscBlobHandle blob_handle,
                          byte[] buffer)
                   throws GDSException
Description copied from interface: GDS
Write a segment of data to a blob.

Parameters:
blob_handle - Handle to the blob to which data is to be written
buffer - Data to be written to the blob
Throws:
GDSException - if an error occurs while writing to the blob

iscReconnectTransaction

public void iscReconnectTransaction(IscTrHandle tr_handle,
                                    IscDbHandle db_handle,
                                    long transactionId)
                             throws GDSException
Description copied from interface: GDS
Reconnect "in limbo" transaction using new database handle.

Parameters:
tr_handle - transaction handle that will be reconnected.
db_handle - database handle in which "in limbo" transaction will be reconnected.
transactionId - ID of the transaction to reconnect.
Throws:
GDSException - if something went wrong.

iscRollbackRetaining

public void iscRollbackRetaining(IscTrHandle tr_handle)
                          throws GDSException
Throws:
GDSException

iscRollbackTransaction

public void iscRollbackTransaction(IscTrHandle tr_handle)
                            throws GDSException
Description copied from interface: GDS
Rollback a transaction.

Parameters:
tr_handle - Handle to the transaction that is to be rolled back
Throws:
GDSException - if an error occurs while rolling back
See Also:
GDS.iscCommitTransaction(IscTrHandle)

iscTransactionInformation

public byte[] iscTransactionInformation(IscTrHandle trHandle,
                                        byte[] requestBuffer,
                                        int bufferLen)
                                 throws GDSException
Throws:
GDSException

iscSeekBlob

public void iscSeekBlob(IscBlobHandle handle,
                        int position,
                        int mode)
                 throws GDSException
Description copied from interface: GDS
Seek to a given position in a blob. seekMode is used in the same way as the system fseek call, i.e.:

position is the offset number of bytes to seek to, relative to the position described by seekMode. Seeking can only be done in a forward direction.

Parameters:
handle - Handle to the blob for which seeking will be done
position - The offset number of bytes to seek to
mode - Describes the base point to be used in seeking, should be negative if seekMode is equal to 2
Throws:
GDSException - if an error occurs while seeking

iscServiceAttach

public void iscServiceAttach(String service,
                             IscSvcHandle serviceHandle,
                             ServiceParameterBuffer serviceParameterBuffer)
                      throws GDSException
Description copied from interface: GDS
Attach to a Service Manager.

Parameters:
service - The name/path to the service manager
serviceHandle - Handle to be linked to the attached service manager
serviceParameterBuffer - Contains parameters for attaching to the service manager
Throws:
GDSException - if an error occurs while attaching

iscServiceDetach

public void iscServiceDetach(IscSvcHandle serviceHandle)
                      throws GDSException
Description copied from interface: GDS
Detach from a Service Manager.

Parameters:
serviceHandle - Handle to the service manager that is to be detached
Throws:
GDSException - if an error occurs while detaching

iscServiceQuery

public void iscServiceQuery(IscSvcHandle serviceHandle,
                            ServiceParameterBuffer serviceParameterBuffer,
                            ServiceRequestBuffer serviceRequestBuffer,
                            byte[] resultBuffer)
                     throws GDSException
Description copied from interface: GDS
Query a service manager

Parameters:
serviceHandle - Handle to the service manager to be queried
serviceParameterBuffer - parameters about the service
serviceRequestBuffer - parameters requested in the query
resultBuffer - buffer to hold the query results
Throws:
GDSException - if an error occurs while querying

iscServiceStart

public void iscServiceStart(IscSvcHandle serviceHandle,
                            ServiceRequestBuffer serviceRequestBuffer)
                     throws GDSException
Description copied from interface: GDS
Start a service operation.

Parameters:
serviceHandle - Handle to the service manager where the operation is to be started
serviceRequestBuffer - parameters about the service to be started
Throws:
GDSException

iscStartTransaction

public void iscStartTransaction(IscTrHandle tr_handle,
                                IscDbHandle db_handle,
                                TransactionParameterBuffer tpb)
                         throws GDSException
Description copied from interface: GDS
Start a transaction based on a handle to a transaction.

Parameters:
tr_handle - Handle to the transaction that is to be started
db_handle - Handle to the database in which the transaction is to be started
tpb - Transaction Parameter Block in the form of a byte array, contains parameter data for the transaction attributes
Throws:
GDSException - if an error occurs while starting the transaction
See Also:
GDS.createIscTrHandle()

iscVaxInteger

public int iscVaxInteger(byte[] buffer,
                         int pos,
                         int length)
Description copied from interface: GDS
Retrieve an integer value from a sequence of bytes.

Parameters:
buffer - The byte array from which the integer is to be retrieved
pos - The offset starting position from which to start retrieving byte values
length - The number of bytes to use in retrieving the integer value.
Returns:
The integer value retrieved from the bytes

iscVaxInteger2

public int iscVaxInteger2(byte[] buffer,
                          int pos)

native_isc_attach_database

public abstract void native_isc_attach_database(byte[] file_name,
                                                IscDbHandle db_handle,
                                                byte[] dpbBytes)

native_isc_blob_info

public abstract byte[] native_isc_blob_info(isc_blob_handle_impl handle,
                                            byte[] items,
                                            int buffer_length)
                                     throws GDSException
Throws:
GDSException

native_isc_close_blob

public abstract void native_isc_close_blob(IscBlobHandle blob)
                                    throws GDSException
Throws:
GDSException

native_isc_commit_retaining

public abstract void native_isc_commit_retaining(IscTrHandle tr_handle)
                                          throws GDSException
Throws:
GDSException

native_isc_commit_transaction

public abstract void native_isc_commit_transaction(IscTrHandle tr_handle)
                                            throws GDSException
Throws:
GDSException

native_isc_create_blob2

public abstract void native_isc_create_blob2(IscDbHandle db,
                                             IscTrHandle tr,
                                             IscBlobHandle blob,
                                             byte[] dpbBytes)

native_isc_create_database

public abstract void native_isc_create_database(byte[] file_name,
                                                IscDbHandle db_handle,
                                                byte[] dpbBytes)

native_isc_database_info

public abstract void native_isc_database_info(IscDbHandle db_handle,
                                              int item_length,
                                              byte[] items,
                                              int buffer_length,
                                              byte[] buffer)
                                       throws GDSException
Throws:
GDSException

native_isc_detach_database

public abstract void native_isc_detach_database(IscDbHandle db_handle)
                                         throws GDSException
Throws:
GDSException

native_isc_drop_database

public abstract void native_isc_drop_database(IscDbHandle db_handle)
                                       throws GDSException
Throws:
GDSException

native_isc_dsql_alloc_statement2

public abstract void native_isc_dsql_alloc_statement2(IscDbHandle db_handle,
                                                      IscStmtHandle stmt_handle)
                                               throws GDSException
Throws:
GDSException

native_isc_dsql_allocate_statement

public abstract void native_isc_dsql_allocate_statement(IscDbHandle db_handle,
                                                        IscStmtHandle stmt_handle)
                                                 throws GDSException
Throws:
GDSException

native_isc_dsql_describe

public abstract XSQLDA native_isc_dsql_describe(IscStmtHandle stmt_handle,
                                                int da_version)
                                         throws GDSException
Throws:
GDSException

native_isc_dsql_describe_bind

public abstract XSQLDA native_isc_dsql_describe_bind(IscStmtHandle stmt_handle,
                                                     int da_version)
                                              throws GDSException
Throws:
GDSException

native_isc_dsql_exec_immed2

public abstract void native_isc_dsql_exec_immed2(IscDbHandle db_handle,
                                                 IscTrHandle tr_handle,
                                                 byte[] statement,
                                                 int dialect,
                                                 XSQLDA in_xsqlda,
                                                 XSQLDA out_xsqlda)
                                          throws GDSException
Throws:
GDSException

native_isc_dsql_execute2

public abstract void native_isc_dsql_execute2(IscTrHandle tr_handle,
                                              IscStmtHandle stmt_handle,
                                              int da_version,
                                              XSQLDA in_xsqlda,
                                              XSQLDA out_xsqlda)
                                       throws GDSException
Throws:
GDSException

native_isc_dsql_fetch

public abstract boolean native_isc_dsql_fetch(IscStmtHandle stmt_handle,
                                              int da_version,
                                              XSQLDA xsqlda,
                                              int fetchSize)
                                       throws GDSException
Throws:
GDSException

native_isc_dsql_free_statement

public abstract void native_isc_dsql_free_statement(IscStmtHandle stmt_handle,
                                                    int option)
                                             throws GDSException
Throws:
GDSException

native_isc_dsql_prepare

public abstract XSQLDA native_isc_dsql_prepare(IscTrHandle tr_handle,
                                               IscStmtHandle stmt_handle,
                                               byte[] statement,
                                               int dialect)
                                        throws GDSException
Throws:
GDSException

native_isc_dsql_set_cursor_name

public abstract void native_isc_dsql_set_cursor_name(IscStmtHandle stmt_handle,
                                                     String cursor_name,
                                                     int type)
                                              throws GDSException
Throws:
GDSException

native_isc_dsql_sql_info

public abstract byte[] native_isc_dsql_sql_info(IscStmtHandle stmt_handle,
                                                byte[] items,
                                                int buffer_length)
                                         throws GDSException
Throws:
GDSException

native_isc_get_segment

public abstract byte[] native_isc_get_segment(IscBlobHandle blob,
                                              int maxread)
                                       throws GDSException
Throws:
GDSException

native_isc_open_blob2

public abstract void native_isc_open_blob2(IscDbHandle db,
                                           IscTrHandle tr,
                                           IscBlobHandle blob,
                                           byte[] dpbBytes)

native_isc_prepare_transaction

public abstract void native_isc_prepare_transaction(IscTrHandle tr_handle)
                                             throws GDSException
Throws:
GDSException

native_isc_prepare_transaction2

public abstract void native_isc_prepare_transaction2(IscTrHandle tr_handle,
                                                     byte[] bytes)
                                              throws GDSException
Throws:
GDSException

native_isc_put_segment

public abstract void native_isc_put_segment(IscBlobHandle blob_handle,
                                            byte[] buffer)
                                     throws GDSException
Throws:
GDSException

native_isc_rollback_retaining

public abstract void native_isc_rollback_retaining(IscTrHandle tr_handle)
                                            throws GDSException
Throws:
GDSException

native_isc_rollback_transaction

public abstract void native_isc_rollback_transaction(IscTrHandle tr_handle)
                                              throws GDSException
Throws:
GDSException

native_isc_seek_blob

public abstract void native_isc_seek_blob(isc_blob_handle_impl handle,
                                          int position,
                                          int mode)
                                   throws GDSException
Throws:
GDSException

native_isc_service_attach

public abstract void native_isc_service_attach(String service,
                                               IscSvcHandle serviceHandle,
                                               byte[] serviceParameterBuffer)
                                        throws GDSException
Throws:
GDSException

native_isc_service_detach

public abstract void native_isc_service_detach(IscSvcHandle serviceHandle)
                                        throws GDSException
Throws:
GDSException

native_isc_service_query

public abstract void native_isc_service_query(IscSvcHandle serviceHandle,
                                              byte[] sendServiceParameterBuffer,
                                              byte[] requestServiceParameterBuffer,
                                              byte[] resultBuffer)
                                       throws GDSException
Throws:
GDSException

native_isc_service_start

public abstract void native_isc_service_start(IscSvcHandle serviceHandle,
                                              byte[] serviceParameterBuffer)
                                       throws GDSException
Throws:
GDSException

native_isc_start_transaction

public abstract void native_isc_start_transaction(IscTrHandle tr_handle,
                                                  IscDbHandle db_handle,
                                                  byte[] tpb)
                                           throws GDSException
Throws:
GDSException

native_isc_reconnect_transaction

public abstract void native_isc_reconnect_transaction(IscDbHandle dbHandle,
                                                      IscTrHandle trHandle,
                                                      byte[] txId)
                                               throws GDSException
Throws:
GDSException

native_isc_transaction_info

public abstract byte[] native_isc_transaction_info(IscTrHandle tr_handle,
                                                   byte[] items,
                                                   int bufferSize)
                                            throws GDSException
Throws:
GDSException

native_isc_que_events

public abstract int native_isc_que_events(IscDbHandle db_handle,
                                          EventHandleImp eventHandle,
                                          EventHandler handler)
                                   throws GDSException
Throws:
GDSException

native_isc_event_block

public abstract long native_isc_event_block(EventHandleImp eventHandle,
                                            String eventNames)
                                     throws GDSException
Throws:
GDSException

native_isc_event_counts

public abstract void native_isc_event_counts(EventHandleImp eventHandle)
                                      throws GDSException
Throws:
GDSException

native_isc_cancel_events

public abstract void native_isc_cancel_events(IscDbHandle db_handle,
                                              EventHandleImp eventHandle)
                                       throws GDSException
Throws:
GDSException

newTransactionParameterBuffer

public TransactionParameterBuffer newTransactionParameterBuffer()
Description copied from interface: GDS
Create new TransactionParameterBuffer instance for setting transaction parameters in the current GDS implementation.

Returns:
A new TransactionParameterBuffer.

readSQLData

public void readSQLData(XSQLDA xsqlda,
                        isc_stmt_handle_impl stmt)

getByteArrayForString

protected byte[] getByteArrayForString(String statement,
                                       String encoding)
                                throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

getZeroTerminatedArray

protected byte[] getZeroTerminatedArray(byte[] stringBytes)

getSqlCounts

public void getSqlCounts(IscStmtHandle stmt_handle)
                  throws GDSException
Description copied from interface: GDS
Fetch count information for a statement. The count information that is retrieved includes counts for all CRUD operations, and is set in the handle itself.

Parameters:
stmt_handle - Handle to the statement for which count data is to be retrieved
Throws:
GDSException - if an error occurs while retrieving the count data

iscQueueEvents

public int iscQueueEvents(IscDbHandle dbHandle,
                          EventHandle eventHandle,
                          EventHandler eventHandler)
                   throws GDSException
Description copied from interface: GDS
Queue an EventHandler.

Parameters:
dbHandle - Handle to the database where events are to be listened for
eventHandle - Handle for event management
eventHandler - Callback to be called when an event occurs
Throws:
GDSException - If a database communication error occurs

iscEventBlock

public void iscEventBlock(EventHandle eventHandle)
                   throws GDSException
Description copied from interface: GDS
Initialize the internal databastructures for an EventHandle.

Parameters:
eventHandle - The event handle to be initialized
Throws:
GDSException - If a database communication error occurs

iscEventCounts

public void iscEventCounts(EventHandle eventHandle)
                    throws GDSException
Description copied from interface: GDS
Retrieve count information after an event has occurred.

Parameters:
eventHandle - The handle containing event data
Throws:
GDSException - If a database communication error occurs

iscCancelEvents

public void iscCancelEvents(IscDbHandle dbHandle,
                            EventHandle eventHandle)
                     throws GDSException
Description copied from interface: GDS
Cancel event listening based on an EventHandle.

Parameters:
dbHandle - Handle to the database where events are being listened for
eventHandle - Datastructure for handling event data
Throws:
GDSException - If a database communication error occurs

createEventHandle

public EventHandle createEventHandle(String eventName)
Description copied from interface: GDS
Create a new EventHandle specific to a given GDS implementation.

Returns:
The newly created EventHandle


Copyright © 2001-2010. All Rights Reserved.