Class V10Statement
- java.lang.Object
- 
- org.firebirdsql.gds.ng.AbstractFbStatement
- 
- org.firebirdsql.gds.ng.wire.AbstractFbWireStatement
- 
- org.firebirdsql.gds.ng.wire.version10.V10Statement
 
 
 
- 
- All Implemented Interfaces:
- FbStatement,- ExceptionListenable,- FbWireStatement
 - Direct Known Subclasses:
- V11Statement
 
 public class V10Statement extends AbstractFbWireStatement implements FbWireStatement - Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Field Summary- 
Fields inherited from class org.firebirdsql.gds.ng.AbstractFbStatementexceptionListenerDispatcher, statementListenerDispatcher
 
- 
 - 
Constructor SummaryConstructors Constructor Description V10Statement(FbWireDatabase database)Creates a new instance of V10Statement for the specified database.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoFreePacket(int option)Handles sending the free statement packet and associated state changes on this statementvoidexecute(RowValue parameters)Execute the statement.voidfetchRows(int fetchSize)Requests this statement to fetch the nextfetchSizerows.protected voidfree(int option)Frees the currently allocated statement (either close the cursor withISCConstants.DSQL_closeor drop the statement handle usingISCConstants.DSQL_drop.intgetDefaultSqlInfoSize()intgetMaxSqlInfoSize()byte[]getSqlInfo(byte[] requestItems, int bufferLength)Request statement info.voidprepare(java.lang.String statementText)Prepare the statement text.protected voidprocessAllocateResponse(GenericResponse response)Processes the allocate response from the server.protected voidprocessExecuteResponse(GenericResponse genericResponse)Process the execute response.protected voidprocessExecuteSingletonResponse(SqlResponse sqlResponse)Process the execute response for statements with a singleton response (op_execute2; stored procedures).protected voidprocessFetchResponse()Process the fetch response by reading the returned rows and queuing them.protected voidprocessFreeResponse(Response response)Processes the response to the free statement.protected byte[]processInfoSqlResponse(GenericResponse response)Processes the info sql response.protected voidprocessPrepareResponse(GenericResponse genericResponse)Processes the prepare response from the server.protected byte[]readColumnData(XdrInputStream xdrIn, int len)protected RowValuereadSqlData()Reads a single row from the database.protected voidsendAllocate()Sends the allocate request to the server.protected voidsendExecute(int operation, RowValue parameters)Sends the execute (forop_executeorop_execute2) to the database.protected voidsendFetch(int fetchSize)Sends the fetch request to the database.protected voidsendFree(int option)Sends the free statement to the databaseprotected voidsendInfoSql(byte[] requestItems, int bufferLength)Sends the info sql request to the databaseprotected voidsendPrepare(java.lang.String statementText)Sends the statement prepare to the connection.voidsetCursorName(java.lang.String cursorName)Sets the named cursor name for this statement.protected voidwriteColumnData(XdrOutputStream xdrOut, int len, byte[] buffer, int fieldType)protected voidwriteSqlData(RowDescriptor rowDescriptor, RowValue fieldValues)Write a set of SQL data from aRowValue.- 
Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireStatementcalculateBlr, calculateBlr, close, emptyRowDescriptor, getDatabase, getHandle, getXdrIn, getXdrOut, isValidTransactionClass, setHandle
 - 
Methods inherited from class org.firebirdsql.gds.ng.AbstractFbStatementaddExceptionListener, addStatementListener, checkStatementValid, checkStatementValid, closeCursor, closeCursor, createExecutionPlanProcessor, createSqlCountProcessor, ensureClosedCursor, finalize, getAllowedTimeout, getExecutionPlan, getExplainedExecutionPlan, getFieldDescriptor, getParameterDescriptionInfoRequestItems, getParameterDescriptor, getRowDescriptor, getSqlCounts, getSqlInfo, getState, getStatementInfoRequestItems, getStatementWarningCallback, getSynchronizationObject, getTimeout, getTransaction, getTransactionListener, getType, hasFields, hasSingletonResult, isAllRowsFetched, isPrepareAllowed, parseStatementInfo, queueRowData, removeExceptionListener, removeStatementListener, reset, reset, resetAll, setAllRowsFetched, setFieldDescriptor, setParameterDescriptor, setRowDescriptor, setTimeout, setTransaction, setType, signalExecute, signalFetch, switchState, validateParameters
 - 
Methods inherited from class java.lang.Objectclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenableaddExceptionListener, removeExceptionListener
 - 
Methods inherited from interface org.firebirdsql.gds.ng.FbStatementaddStatementListener, close, closeCursor, closeCursor, emptyRowDescriptor, ensureClosedCursor, getDatabase, getExecutionPlan, getExplainedExecutionPlan, getFieldDescriptor, getHandle, getParameterDescriptor, getRowDescriptor, getSqlCounts, getSqlInfo, getState, getTimeout, getTransaction, getType, removeStatementListener, setTimeout, setTransaction, validateParameters
 
- 
 
- 
- 
- 
Constructor Detail- 
V10Statementpublic V10Statement(FbWireDatabase database) Creates a new instance of V10Statement for the specified database.- Parameters:
- database- FbWireDatabase implementation
 
 
- 
 - 
Method Detail- 
getSqlInfopublic byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws java.sql.SQLExceptionDescription copied from interface:FbStatementRequest statement info.- Specified by:
- getSqlInfoin interface- FbStatement
- Parameters:
- requestItems- Array of info items to request
- bufferLength- Response buffer length to use
- Returns:
- Response buffer
- Throws:
- java.sql.SQLException
 
 - 
sendInfoSqlprotected void sendInfoSql(byte[] requestItems, int bufferLength) throws java.io.IOException, java.sql.SQLExceptionSends the info sql request to the database- Parameters:
- requestItems- Info request items
- bufferLength- Requested response buffer length
- Throws:
- java.io.IOException
- java.sql.SQLException
 
 - 
processInfoSqlResponseprotected byte[] processInfoSqlResponse(GenericResponse response) Processes the info sql response.- Parameters:
- response- GenericResponse
- Returns:
- info sql response buffer
 
 - 
freeprotected void free(int option) throws java.sql.SQLExceptionDescription copied from class:AbstractFbStatementFrees the currently allocated statement (either close the cursor withISCConstants.DSQL_closeor drop the statement handle usingISCConstants.DSQL_drop.- Specified by:
- freein class- AbstractFbStatement
- Parameters:
- option- Free option
- Throws:
- java.sql.SQLException
 
 - 
doFreePacketprotected void doFreePacket(int option) throws java.sql.SQLException, java.io.IOExceptionHandles sending the free statement packet and associated state changes on this statement- Parameters:
- option- Free statement option
- Throws:
- java.sql.SQLException
- java.io.IOException
 
 - 
sendFreeprotected void sendFree(int option) throws java.io.IOException, java.sql.SQLExceptionSends the free statement to the database- Parameters:
- option- Free statement option
- Throws:
- java.io.IOException
- java.sql.SQLException
 
 - 
processFreeResponseprotected void processFreeResponse(Response response) Processes the response to the free statement.- Parameters:
- response- Response object
 
 - 
preparepublic void prepare(java.lang.String statementText) throws java.sql.SQLExceptionDescription copied from interface:FbStatementPrepare the statement text.If this handle is in state StatementState.NEWthen it will first allocate the statement.- Specified by:
- preparein interface- FbStatement
- Parameters:
- statementText- Statement text
- Throws:
- java.sql.SQLException- If a database access error occurs, or this statement is currently executing a query.
 
 - 
sendPrepareprotected void sendPrepare(java.lang.String statementText) throws java.sql.SQLException, java.io.IOExceptionSends the statement prepare to the connection.- Parameters:
- statementText- Statement
- Throws:
- java.sql.SQLException
- java.io.IOException
 
 - 
processPrepareResponseprotected void processPrepareResponse(GenericResponse genericResponse) throws java.sql.SQLException Processes the prepare response from the server.- Parameters:
- genericResponse- GenericResponse
- Throws:
- java.sql.SQLException
 
 - 
setCursorNamepublic void setCursorName(java.lang.String cursorName) throws java.sql.SQLExceptionDescription copied from interface:FbStatementSets the named cursor name for this statement.- Specified by:
- setCursorNamein interface- FbStatement
- Parameters:
- cursorName- Name of the cursor
- Throws:
- java.sql.SQLException- If this statement is closed, TODO: Other reasons (eg cursor open)?
 
 - 
executepublic void execute(RowValue parameters) throws java.sql.SQLException Description copied from interface:FbStatementExecute the statement.- Specified by:
- executein interface- FbStatement
- Parameters:
- parameters- The list of parameter values to use for execution.
- Throws:
- java.sql.SQLException- When the number of type of parameters does not match the types returned by- FbStatement.getParameterDescriptor(), a parameter value was not set, or when an error occurred executing this statement.
 
 - 
sendExecuteprotected void sendExecute(int operation, RowValue parameters) throws java.io.IOException, java.sql.SQLExceptionSends the execute (forop_executeorop_execute2) to the database.- Parameters:
- operation- Operation (- op_executeor- op_execute2)
- parameters- Parameters
- Throws:
- java.io.IOException
- java.sql.SQLException
 
 - 
processExecuteSingletonResponseprotected void processExecuteSingletonResponse(SqlResponse sqlResponse) throws java.sql.SQLException, java.io.IOException Process the execute response for statements with a singleton response (op_execute2; stored procedures).- Parameters:
- sqlResponse- SQL response object
- Throws:
- java.sql.SQLException
- java.io.IOException
 
 - 
processExecuteResponseprotected void processExecuteResponse(GenericResponse genericResponse) Process the execute response.- Parameters:
- genericResponse- Generic response object
 
 - 
fetchRowspublic void fetchRows(int fetchSize) throws java.sql.SQLExceptionDescription copied from interface:FbStatementRequests this statement to fetch the nextfetchSizerows.Fetched rows are not returned from this method, but sent to the registered StatementListenerinstances.- Specified by:
- fetchRowsin interface- FbStatement
- Parameters:
- fetchSize- Number of rows to fetch (must be- > 0)
- Throws:
- java.sql.SQLException- For database access errors, when called on a closed statement, when no cursor is open or when the fetch size is not- > 0.
 
 - 
processFetchResponseprotected void processFetchResponse() throws java.io.IOException, java.sql.SQLExceptionProcess the fetch response by reading the returned rows and queuing them.- Throws:
- java.io.IOException
- java.sql.SQLException
 
 - 
sendFetchprotected void sendFetch(int fetchSize) throws java.sql.SQLException, java.io.IOExceptionSends the fetch request to the database.- Parameters:
- fetchSize- Number of rows to fetch.
- Throws:
- java.sql.SQLException
- java.io.IOException
 
 - 
readSqlDataprotected RowValue readSqlData() throws java.sql.SQLException, java.io.IOException Reads a single row from the database.- Returns:
- Row as a RowValue
- Throws:
- java.sql.SQLException
- java.io.IOException
 
 - 
readColumnDataprotected byte[] readColumnData(XdrInputStream xdrIn, int len) throws java.io.IOException - Throws:
- java.io.IOException
 
 - 
writeSqlDataprotected void writeSqlData(RowDescriptor rowDescriptor, RowValue fieldValues) throws java.io.IOException, java.sql.SQLException Write a set of SQL data from aRowValue.- Parameters:
- rowDescriptor- The row descriptor
- fieldValues- The List containing the SQL data to be written
- Throws:
- java.io.IOException- if an error occurs while writing to the underlying output stream
- java.sql.SQLException
 
 - 
writeColumnDataprotected void writeColumnData(XdrOutputStream xdrOut, int len, byte[] buffer, int fieldType) throws java.io.IOException - Throws:
- java.io.IOException
 
 - 
sendAllocateprotected void sendAllocate() throws java.sql.SQLException, java.io.IOExceptionSends the allocate request to the server.- Throws:
- java.sql.SQLException
- java.io.IOException
 
 - 
processAllocateResponseprotected void processAllocateResponse(GenericResponse response) throws java.sql.SQLException Processes the allocate response from the server.- Parameters:
- response- GenericResponse
- Throws:
- java.sql.SQLException
 
 - 
getDefaultSqlInfoSizepublic int getDefaultSqlInfoSize() - Specified by:
- getDefaultSqlInfoSizein interface- FbStatement
- Returns:
- The default size to use for the sql info buffer
 
 - 
getMaxSqlInfoSizepublic int getMaxSqlInfoSize() - Specified by:
- getMaxSqlInfoSizein interface- FbStatement
- Returns:
- The maximum size to use for the sql info buffer
 
 
- 
 
-