use of org.firebirdsql.gds.impl.wire.XdrOutputStream in project jaybird by FirebirdSQL.
the class V10Statement method sendAllocate.
/**
* Sends the allocate request to the server.
*
* @throws SQLException
* @throws IOException
*/
protected void sendAllocate() throws SQLException, IOException {
final XdrOutputStream xdrOut = getXdrOut();
xdrOut.writeInt(WireProtocolConstants.op_allocate_statement);
xdrOut.writeInt(getDatabase().getHandle());
}
use of org.firebirdsql.gds.impl.wire.XdrOutputStream in project jaybird by FirebirdSQL.
the class V10Statement method writeSqlData.
/**
* Write a set of SQL data from a list of {@link FieldValue} instances.
*
* @param rowDescriptor
* The row descriptor
* @param fieldValues
* The List containing the SQL data to be written
* @throws IOException
* if an error occurs while writing to the underlying output stream
*/
protected void writeSqlData(final RowDescriptor rowDescriptor, final RowValue fieldValues) throws IOException, SQLException {
final XdrOutputStream xdrOut = getXdrOut();
final BlrCalculator blrCalculator = getDatabase().getBlrCalculator();
for (int idx = 0; idx < fieldValues.getCount(); idx++) {
final FieldValue fieldValue = fieldValues.getFieldValue(idx);
final FieldDescriptor fieldDescriptor = rowDescriptor.getFieldDescriptor(idx);
final int len = blrCalculator.calculateIoLength(fieldDescriptor, fieldValue);
final byte[] buffer = fieldValue.getFieldData();
final int fieldType = fieldDescriptor.getType();
writeColumnData(xdrOut, len, buffer, fieldType);
// sqlind (null indicator)
xdrOut.writeInt(buffer != null ? NULL_INDICATOR_NOT_NULL : NULL_INDICATOR_NULL);
}
}
use of org.firebirdsql.gds.impl.wire.XdrOutputStream in project jaybird by FirebirdSQL.
the class V10Statement method sendFree.
/**
* Sends the free statement to the database
*
* @param option
* Free statement option
* @throws IOException
* @throws SQLException
*/
protected void sendFree(int option) throws IOException, SQLException {
final XdrOutputStream xdrOut = getXdrOut();
xdrOut.writeInt(WireProtocolConstants.op_free_statement);
xdrOut.writeInt(getHandle());
xdrOut.writeInt(option);
}
use of org.firebirdsql.gds.impl.wire.XdrOutputStream in project jaybird by FirebirdSQL.
the class V10Statement method sendInfoSql.
/**
* Sends the info sql request to the database
*
* @param requestItems
* Info request items
* @param bufferLength
* Requested response buffer length
* @throws IOException
* @throws SQLException
*/
protected void sendInfoSql(final byte[] requestItems, final int bufferLength) throws IOException, SQLException {
final XdrOutputStream xdrOut = getXdrOut();
xdrOut.writeInt(WireProtocolConstants.op_info_sql);
xdrOut.writeInt(getHandle());
// incarnation
xdrOut.writeInt(0);
xdrOut.writeBuffer(requestItems);
xdrOut.writeInt(bufferLength);
}
use of org.firebirdsql.gds.impl.wire.XdrOutputStream in project jaybird by FirebirdSQL.
the class V10Statement method sendFetch.
/**
* Sends the fetch request to the database.
*
* @param fetchSize Number of rows to fetch.
* @throws SQLException
* @throws IOException
*/
protected void sendFetch(int fetchSize) throws SQLException, IOException {
final XdrOutputStream xdrOut = getXdrOut();
xdrOut.writeInt(WireProtocolConstants.op_fetch);
xdrOut.writeInt(getHandle());
xdrOut.writeBuffer(calculateBlr(getFieldDescriptor()));
// out_message_number = out_message_type
xdrOut.writeInt(0);
// fetch size
xdrOut.writeInt(fetchSize);
}
Aggregations