org.firebirdsql.gds.impl.wire
Class AbstractJavaGDSImpl

java.lang.Object
  extended by org.firebirdsql.gds.impl.AbstractGDS
      extended by org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl
All Implemented Interfaces:
Externalizable, Serializable, GDS
Direct Known Subclasses:
JavaGDSImpl

public abstract class AbstractJavaGDSImpl
extends AbstractGDS
implements GDS

Describe class GDS_Impl here.

Version:
1.0
Author:
Alejandro Alberola, David Jencks
See Also:
Serialized Form

Nested Class Summary
protected static class AbstractJavaGDSImpl.DbAttachInfo
           
 
Field Summary
static String PURE_JAVA_TYPE_NAME
           
 
Constructor Summary
AbstractJavaGDSImpl()
           
 
Method Summary
static void calculateBLR(XSQLDA xsqlda)
           
static void calculateIOLength(XSQLDA xsqlda)
           
protected  void connect(isc_db_handle_impl db, AbstractJavaGDSImpl.DbAttachInfo dbai, DatabaseParameterBuffer databaseParameterBuffer)
           
 void connect(isc_db_handle_impl db, String host, Integer port, String filename, DatabaseParameterBuffer databaseParameterBuffer)
           
 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.
 void disconnect(isc_db_handle_impl db)
           
abstract  Socket getSocket(String server, int port)
          Returns a newly created socket.
 void getSqlCounts(IscStmtHandle stmt_handle)
          Fetch count information for a statement.
 void internalAttachDatabase(AbstractJavaGDSImpl.DbAttachInfo dbai, IscDbHandle db_handle, DatabaseParameterBuffer databaseParameterBuffer)
           
 void internalAttachDatabase(String host, Integer port, String file_name, IscDbHandle db_handle, DatabaseParameterBuffer databaseParameterBuffer)
           
 void isc_dsql_alloc_statement2(IscDbHandle db_handle, IscStmtHandle stmt_handle)
           
 void iscAttachDatabase(String connectString, 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)
          isc_create_database creates a database based on the file name and Clumplet of database properties supplied.
 byte[] iscDatabaseInfo(IscDbHandle 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_handle, int requested)
          Fetch a segment of a blob.
 int iscInteger(byte[] buffer, int pos, int length)
           
 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 seekMode)
          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 tr_handle, byte[] requestBuffer, int bufferLen)
           
 int iscVaxInteger(byte[] buffer, int pos, int length)
          Retrieve an integer value from a sequence of bytes.
 TransactionParameterBuffer newTransactionParameterBuffer()
          Create new TransactionParameterBuffer instance for setting transaction parameters in the current GDS implementation.
protected  int nextOperation(isc_db_handle_impl db)
           
protected  int nextOperation(isc_svc_handle_impl svc)
           
protected  void openSocket(isc_db_handle_impl db, AbstractJavaGDSImpl.DbAttachInfo dbai, boolean debug, int socketBufferSize)
           
 void receiveResponse(isc_db_handle_impl db, int op)
           
 void receiveResponse(isc_svc_handle_impl svc, int op)
           
 
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
 
Methods inherited from interface org.firebirdsql.gds.GDS
close
 

Field Detail

PURE_JAVA_TYPE_NAME

public static final String PURE_JAVA_TYPE_NAME
See Also:
Constant Field Values
Constructor Detail

AbstractJavaGDSImpl

public AbstractJavaGDSImpl()
Method Detail

iscCreateDatabase

public void iscCreateDatabase(String file_name,
                              IscDbHandle db_handle,
                              DatabaseParameterBuffer databaseParameterBuffer)
                       throws GDSException
isc_create_database creates a database based on the file name and Clumplet of database properties supplied. The supplied db handle is attached to the newly created database.

Specified by:
iscCreateDatabase in interface GDS
Parameters:
file_name - a String the file name, including host and port, for the database. The expected format is host:port:path_to_file. The value for host is localhost if not supplied. The value for port is 3050 if not supplied.
db_handle - an isc_db_handle The db handle to attach to the new database.
databaseParameterBuffer - a Clumplet The parameters for the new database and the attachment to it. See docs for dpb (database parameter block.)
Throws:
GDSException - if an error occurs

internalAttachDatabase

public void internalAttachDatabase(String host,
                                   Integer port,
                                   String file_name,
                                   IscDbHandle db_handle,
                                   DatabaseParameterBuffer databaseParameterBuffer)
                            throws GDSException
Throws:
GDSException

iscAttachDatabase

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

Specified by:
iscAttachDatabase in interface GDS
Parameters:
connectString - 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

internalAttachDatabase

public void internalAttachDatabase(AbstractJavaGDSImpl.DbAttachInfo dbai,
                                   IscDbHandle db_handle,
                                   DatabaseParameterBuffer databaseParameterBuffer)
                            throws GDSException
Throws:
GDSException

iscDatabaseInfo

public byte[] iscDatabaseInfo(IscDbHandle 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

Specified by:
iscDatabaseInfo in interface GDS
Parameters:
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

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.

Specified by:
iscBlobInfo in interface GDS
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

iscSeekBlob

public void iscSeekBlob(IscBlobHandle handle,
                        int position,
                        int seekMode)
                 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.

Specified by:
iscSeekBlob in interface GDS
Parameters:
handle - Handle to the blob for which seeking will be done
position - The offset number of bytes to seek to
seekMode - 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

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.

Specified by:
iscDetachDatabase in interface GDS
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.

Specified by:
iscDropDatabase in interface GDS
Parameters:
db_handle - Handle to the database to be dropped
Throws:
GDSException - if an error occurs while dropping the database

iscExpandDpb

public byte[] iscExpandDpb(byte[] dpb,
                           int dpb_length,
                           int param,
                           Object[] params)
                    throws GDSException
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.

Specified by:
iscStartTransaction in interface GDS
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()

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.

Specified by:
iscReconnectTransaction in interface GDS
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.

iscCommitTransaction

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

Specified by:
iscCommitTransaction in interface GDS
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)

iscCommitRetaining

public void iscCommitRetaining(IscTrHandle tr_handle)
                        throws GDSException
Specified by:
iscCommitRetaining in interface GDS
Throws:
GDSException

iscPrepareTransaction

public void iscPrepareTransaction(IscTrHandle tr_handle)
                           throws GDSException
Specified by:
iscPrepareTransaction in interface GDS
Throws:
GDSException

iscPrepareTransaction2

public void iscPrepareTransaction2(IscTrHandle tr_handle,
                                   byte[] bytes)
                            throws GDSException
Specified by:
iscPrepareTransaction2 in interface GDS
Throws:
GDSException

iscRollbackTransaction

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

Specified by:
iscRollbackTransaction in interface GDS
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)

iscRollbackRetaining

public void iscRollbackRetaining(IscTrHandle tr_handle)
                          throws GDSException
Specified by:
iscRollbackRetaining in interface GDS
Throws:
GDSException

iscTransactionInformation

public byte[] iscTransactionInformation(IscTrHandle tr_handle,
                                        byte[] requestBuffer,
                                        int bufferLen)
                                 throws GDSException
Specified by:
iscTransactionInformation in interface GDS
Throws:
GDSException

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.

Specified by:
iscDsqlAllocateStatement in interface GDS
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

isc_dsql_alloc_statement2

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

iscDsqlDescribe

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

Specified by:
iscDsqlDescribe in interface GDS
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.

Specified by:
iscDsqlDescribeBind in interface GDS
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

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.

Specified by:
iscDsqlExecute in interface GDS
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.

Specified by:
iscDsqlExecute2 in interface GDS
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,
                                    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.

Specified by:
iscDsqlExecuteImmediate in interface GDS
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
Specified by:
iscDsqlExecuteImmediate in interface GDS
Throws:
GDSException

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.

Specified by:
iscDsqlExecuteImmediate in interface GDS
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

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.

Specified by:
iscDsqlExecImmed2 in interface GDS
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
Specified by:
iscDsqlExecImmed2 in interface GDS
Throws:
GDSException

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.

Specified by:
iscDsqlExecImmed2 in interface GDS
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

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.

Specified by:
iscDsqlFetch in interface GDS
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

calculateIOLength

public static void calculateIOLength(XSQLDA xsqlda)

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.

Specified by:
iscDsqlFreeStatement in interface GDS
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,
                             String statement,
                             int dialect)
                      throws GDSException
Description copied from interface: GDS
Prepare a string SQL statement for execution in the database.

Specified by:
iscDsqlPrepare in interface GDS
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
Specified by:
iscDsqlPrepare in interface GDS
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.

Specified by:
iscDsqlPrepare in interface GDS
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

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.

Specified by:
iscDsqlSetCursorName in interface GDS
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.

Specified by:
iscDsqlSqlInfo in interface GDS
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

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.

Specified by:
getSqlCounts in interface GDS
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

iscVaxInteger

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

Specified by:
iscVaxInteger in interface GDS
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

iscInteger

public int iscInteger(byte[] buffer,
                      int pos,
                      int length)

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.

Specified by:
iscCreateBlob2 in interface GDS
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

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.

Specified by:
iscOpenBlob2 in interface GDS
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

iscGetSegment

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

Specified by:
iscGetSegment in interface GDS
Parameters:
blob_handle - Handle to the blob from which a segment is to be fetched
requested - 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

iscPutSegment

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

Specified by:
iscPutSegment in interface GDS
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

iscCloseBlob

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

Specified by:
iscCloseBlob in interface GDS
Parameters:
blob_handle - Handle to the blob to be closed
Throws:
GDSException - if an error occurs while closing the blob

createIscDbHandle

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

Specified by:
createIscDbHandle in interface GDS
Returns:
instance of IscDbHandle

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.

Specified by:
createIscTrHandle in interface GDS
Returns:
A new IscTrHandle instance

createIscStmtHandle

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

Specified by:
createIscStmtHandle in interface GDS
Returns:
A new IscStmtHandle instance

createIscBlobHandle

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

Specified by:
createIscBlobHandle in interface GDS
Returns:
A new IscBlobHandle instance

connect

public void connect(isc_db_handle_impl db,
                    String host,
                    Integer port,
                    String filename,
                    DatabaseParameterBuffer databaseParameterBuffer)
             throws GDSException
Throws:
GDSException

connect

protected void connect(isc_db_handle_impl db,
                       AbstractJavaGDSImpl.DbAttachInfo dbai,
                       DatabaseParameterBuffer databaseParameterBuffer)
                throws GDSException
Throws:
GDSException

getSocket

public abstract Socket getSocket(String server,
                                 int port)
                          throws IOException,
                                 UnknownHostException
Returns a newly created socket. This abstract method is necessary because of a bug found in the JDK5.0 socket implementation. JDK1.4+ has an acceptable work around. See bug details: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5092063

Parameters:
server - The server string.
port - The port to connect to.
Returns:
A valid socket.
Throws:
IOException
UnknownHostException

openSocket

protected void openSocket(isc_db_handle_impl db,
                          AbstractJavaGDSImpl.DbAttachInfo dbai,
                          boolean debug,
                          int socketBufferSize)
                   throws IOException,
                          SocketException,
                          GDSException
Throws:
IOException
SocketException
GDSException

disconnect

public void disconnect(isc_db_handle_impl db)
                throws IOException
Throws:
IOException

receiveResponse

public void receiveResponse(isc_db_handle_impl db,
                            int op)
                     throws GDSException
Throws:
GDSException

nextOperation

protected int nextOperation(isc_db_handle_impl db)
                     throws IOException
Throws:
IOException

calculateBLR

public static void calculateBLR(XSQLDA xsqlda)
                         throws GDSException
Throws:
GDSException

createDatabaseParameterBuffer

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

Specified by:
createDatabaseParameterBuffer in interface GDS
Returns:
A new DatabaseParameterBuffer

newTransactionParameterBuffer

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

Specified by:
newTransactionParameterBuffer in interface GDS
Returns:
A new TransactionParameterBuffer.

createBlobParameterBuffer

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

Specified by:
createBlobParameterBuffer in interface GDS
Returns:
A new BlobParameterBuffer

createServiceParameterBuffer

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

Specified by:
createServiceParameterBuffer in interface GDS
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.

Specified by:
createServiceRequestBuffer in interface GDS
Parameters:
taskIdentifier - The specific Services API task for which the ServiceRequestBuffer is created
Returns:
A new ServiceRequestBuffer

iscServiceAttach

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

Specified by:
iscServiceAttach in interface GDS
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

receiveResponse

public void receiveResponse(isc_svc_handle_impl svc,
                            int op)
                     throws GDSException
Throws:
GDSException

nextOperation

protected int nextOperation(isc_svc_handle_impl svc)
                     throws IOException
Throws:
IOException

iscServiceDetach

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

Specified by:
iscServiceDetach in interface GDS
Parameters:
serviceHandle - Handle to the service manager that is to be detached
Throws:
GDSException - if an error occurs while detaching

iscServiceStart

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

Specified by:
iscServiceStart in interface GDS
Parameters:
serviceHandle - Handle to the service manager where the operation is to be started
serviceRequestBuffer - parameters about the service to be started
Throws:
GDSException

iscServiceQuery

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

Specified by:
iscServiceQuery in interface GDS
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

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.

Specified by:
createIscSvcHandle in interface GDS
Returns:
A new IscSvcHandle instance

iscQueueEvents

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

Specified by:
iscQueueEvents in interface GDS
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.

Specified by:
iscEventBlock in interface GDS
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.

Specified by:
iscEventCounts in interface GDS
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.

Specified by:
iscCancelEvents in interface GDS
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.

Specified by:
createEventHandle in interface GDS
Returns:
The newly created EventHandle


Copyright © 2001-2010. All Rights Reserved.