public class V10Statement extends AbstractFbWireStatement implements FbWireStatement
exceptionListenerDispatcher, statementListenerDispatcher
Constructor and Description |
---|
V10Statement(FbWireDatabase database)
Creates a new instance of V10Statement for the specified database.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doFreePacket(int option)
Handles sending the free statement packet and associated state changes on this statement
|
void |
execute(RowValue parameters)
Execute the statement.
|
void |
fetchRows(int fetchSize)
Requests this statement to fetch the next
fetchSize rows. |
protected void |
free(int option)
Frees the currently allocated statement (either close the cursor with
ISCConstants.DSQL_close or drop the statement
handle using ISCConstants.DSQL_drop . |
int |
getDefaultSqlInfoSize() |
int |
getMaxSqlInfoSize() |
byte[] |
getSqlInfo(byte[] requestItems,
int bufferLength)
Request statement info.
|
void |
prepare(java.lang.String statementText)
Prepare the statement text.
|
protected void |
processAllocateResponse(GenericResponse response)
Processes the allocate response from the server.
|
protected void |
processExecuteResponse(GenericResponse genericResponse)
Process the execute response.
|
protected void |
processExecuteSingletonResponse(SqlResponse sqlResponse)
Process the execute response for statements with a singleton response (
op_execute2 ; stored procedures). |
protected void |
processFetchResponse()
Process the fetch response by reading the returned rows and queuing them.
|
protected void |
processFreeResponse(Response response)
Processes the response to the free statement.
|
protected byte[] |
processInfoSqlResponse(GenericResponse response)
Processes the info sql response.
|
protected void |
processPrepareResponse(GenericResponse genericResponse)
Processes the prepare response from the server.
|
protected byte[] |
readColumnData(XdrInputStream xdrIn,
int len) |
protected RowValue |
readSqlData()
Reads a single row from the database.
|
protected void |
sendAllocate()
Sends the allocate request to the server.
|
protected void |
sendExecute(int operation,
RowValue parameters)
Sends the execute (for
op_execute or op_execute2 ) to the database. |
protected void |
sendFetch(int fetchSize)
Sends the fetch request to the database.
|
protected void |
sendFree(int option)
Sends the free statement to the database
|
protected void |
sendInfoSql(byte[] requestItems,
int bufferLength)
Sends the info sql request to the database
|
protected void |
sendPrepare(java.lang.String statementText)
Sends the statement prepare to the connection.
|
void |
setCursorName(java.lang.String cursorName)
Sets the named cursor name for this statement.
|
protected void |
writeColumnData(XdrOutputStream xdrOut,
int len,
byte[] buffer,
int fieldType) |
protected void |
writeSqlData(RowDescriptor rowDescriptor,
RowValue fieldValues)
Write a set of SQL data from a list of
FieldValue instances. |
calculateBlr, calculateBlr, close, emptyRowDescriptor, getDatabase, getHandle, getXdrIn, getXdrOut, isValidTransactionClass, setHandle
addExceptionListener, addStatementListener, checkStatementValid, closeCursor, closeCursor, createExecutionPlanProcessor, createSqlCountProcessor, ensureClosedCursor, finalize, getExecutionPlan, getFieldDescriptor, getParameterDescriptionInfoRequestItems, getParameterDescriptor, getSqlCounts, getSqlInfo, getState, getStatementInfoRequestItems, getStatementWarningCallback, getSynchronizationObject, getTransaction, getTransactionListener, getType, hasFields, hasSingletonResult, isAllRowsFetched, isPrepareAllowed, parseStatementInfo, queueRowData, removeExceptionListener, removeStatementListener, reset, reset, resetAll, setAllRowsFetched, setFieldDescriptor, setParameterDescriptor, setTransaction, setType, switchState, validateParameters
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStatementListener, close, closeCursor, closeCursor, emptyRowDescriptor, ensureClosedCursor, getDatabase, getExecutionPlan, getFieldDescriptor, getHandle, getParameterDescriptor, getSqlCounts, getSqlInfo, getState, getTransaction, getType, removeStatementListener, setTransaction
addExceptionListener, removeExceptionListener
public V10Statement(FbWireDatabase database)
database
- FbWireDatabase implementationpublic byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws java.sql.SQLException
FbStatement
getSqlInfo
in interface FbStatement
requestItems
- Array of info items to requestbufferLength
- Response buffer length to usejava.sql.SQLException
protected void sendInfoSql(byte[] requestItems, int bufferLength) throws java.io.IOException, java.sql.SQLException
requestItems
- Info request itemsbufferLength
- Requested response buffer lengthjava.io.IOException
java.sql.SQLException
protected byte[] processInfoSqlResponse(GenericResponse response)
response
- GenericResponseprotected void free(int option) throws java.sql.SQLException
AbstractFbStatement
ISCConstants.DSQL_close
or drop the statement
handle using ISCConstants.DSQL_drop
.free
in class AbstractFbStatement
option
- Free optionjava.sql.SQLException
protected void doFreePacket(int option) throws java.sql.SQLException, java.io.IOException
option
- Free statement optionjava.sql.SQLException
java.io.IOException
protected void sendFree(int option) throws java.io.IOException, java.sql.SQLException
option
- Free statement optionjava.io.IOException
java.sql.SQLException
protected void processFreeResponse(Response response)
response
- Response objectpublic void prepare(java.lang.String statementText) throws java.sql.SQLException
FbStatement
If this handle is in state StatementState.NEW
then it will first allocate the statement.
prepare
in interface FbStatement
statementText
- Statement textjava.sql.SQLException
- If a database access error occurs, or this statement is currently executing a query.protected void sendPrepare(java.lang.String statementText) throws java.sql.SQLException, java.io.IOException
statementText
- Statementjava.sql.SQLException
java.io.IOException
protected void processPrepareResponse(GenericResponse genericResponse) throws java.sql.SQLException
genericResponse
- GenericResponsejava.sql.SQLException
public void setCursorName(java.lang.String cursorName) throws java.sql.SQLException
FbStatement
setCursorName
in interface FbStatement
cursorName
- Name of the cursorjava.sql.SQLException
- If this statement is closed, TODO: Other reasons (eg cursor open)?public void execute(RowValue parameters) throws java.sql.SQLException
FbStatement
execute
in interface FbStatement
parameters
- The list of parameter values to use for execution.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.protected void sendExecute(int operation, RowValue parameters) throws java.io.IOException, java.sql.SQLException
op_execute
or op_execute2
) to the database.operation
- Operation (op_execute
or op_execute2
)parameters
- Parametersjava.io.IOException
java.sql.SQLException
protected void processExecuteSingletonResponse(SqlResponse sqlResponse) throws java.sql.SQLException, java.io.IOException
op_execute2
; stored procedures).sqlResponse
- SQL response objectjava.sql.SQLException
java.io.IOException
protected void processExecuteResponse(GenericResponse genericResponse)
genericResponse
- Generic response objectpublic void fetchRows(int fetchSize) throws java.sql.SQLException
FbStatement
fetchSize
rows.
Fetched rows are not returned from this method, but sent to the registered StatementListener
instances.
fetchRows
in interface FbStatement
fetchSize
- Number of rows to fetch (must be > 0
)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
.protected void processFetchResponse() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
protected void sendFetch(int fetchSize) throws java.sql.SQLException, java.io.IOException
fetchSize
- Number of rows to fetch.java.sql.SQLException
java.io.IOException
protected RowValue readSqlData() throws java.sql.SQLException, java.io.IOException
FieldValue
instancesjava.sql.SQLException
java.io.IOException
protected byte[] readColumnData(XdrInputStream xdrIn, int len) throws java.io.IOException
java.io.IOException
protected void writeSqlData(RowDescriptor rowDescriptor, RowValue fieldValues) throws java.io.IOException, java.sql.SQLException
FieldValue
instances.rowDescriptor
- The row descriptorfieldValues
- The List containing the SQL data to be writtenjava.io.IOException
- if an error occurs while writing to the underlying output streamjava.sql.SQLException
protected void writeColumnData(XdrOutputStream xdrOut, int len, byte[] buffer, int fieldType) throws java.io.IOException
java.io.IOException
protected void sendAllocate() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
protected void processAllocateResponse(GenericResponse response) throws java.sql.SQLException
response
- GenericResponsejava.sql.SQLException
public int getDefaultSqlInfoSize()
getDefaultSqlInfoSize
in interface FbStatement
public int getMaxSqlInfoSize()
getMaxSqlInfoSize
in interface FbStatement
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.