org.apache.ignite.internal.processors.odbc.jdbc

## Class JdbcBulkLoadBatchRequest

- java.lang.Object
- - org.apache.ignite.internal.processors.odbc.ClientListenerRequestNoId
  - - org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequest
    - - org.apache.ignite.internal.processors.odbc.jdbc.JdbcBulkLoadBatchRequest

All Implemented Interfaces:
  ClientListenerRequest, JdbcRawBinarylizable

    public class JdbcBulkLoadBatchRequest
    extends JdbcRequest

A JDBC request that sends a batch of a file to the server. Used when handling `SqlBulkLoadCommand` command.

### Field Summary

Fields
`static int` `CMD_CONTINUE` Next batch comes in this request and there are more batches.
`static int` `CMD_FINISHED_EOF` This is the final batch of the file and everything went well on the client side.
`static int` `CMD_FINISHED_ERROR` This is the final batch from the client and there was an error on the client side, so terminate with error on the server side as well.
`static int` `CMD_UNKNOWN` A sentinel to indicate that `cmd` field was not initialized.

### Fields inherited from class org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequest

`BATCH_EXEC`

### Fields inherited from interface org.apache.ignite.internal.processors.odbc.ClientListenerRequest

`HANDSHAKE`

### Constructor Summary

Constructors
Constructor and Description
`JdbcBulkLoadBatchRequest()` Creates the request with uninitialized parameters.
`JdbcBulkLoadBatchRequest(long qryId, int batchIdx, int cmd)` Creates the request with specified parameters and zero-length data.
`JdbcBulkLoadBatchRequest(long qryId, int batchIdx, int cmd, byte[] data)` Creates the request with the specified parameters.

### Method Summary

All Methods Instance Methods Concrete Methods
`long` `batchIdx()` Returns the batch index.
`int` `cmd()` Returns the command (see CMD_xxx constants for details).
`byte[]` `data()` Returns the data.
`long` `queryId()` Returns the original query ID.
`void` `readBinary(BinaryReaderExImpl reader, ClientListenerProtocolVersion ver)` Reads fields from provided reader.
`String` `toString()`
`void` `writeBinary(BinaryWriterExImpl writer, ClientListenerProtocolVersion ver)` Writes fields to provided writer.

### Methods inherited from class org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequest

`readRequest, type`

### Methods inherited from class org.apache.ignite.internal.processors.odbc.ClientListenerRequestNoId

`requestId`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### CMD_UNKNOWN

    public static final int CMD_UNKNOWN

A sentinel to indicate that `cmd` field was not initialized.

See Also:
  Constant Field Values

#### CMD_CONTINUE

    public static final int CMD_CONTINUE

Next batch comes in this request and there are more batches.

See Also:
  Constant Field Values

#### CMD_FINISHED_ERROR

    public static final int CMD_FINISHED_ERROR

This is the final batch from the client and there was an error on the client side, so terminate with error on the server side as well.

See Also:
  Constant Field Values

#### CMD_FINISHED_EOF

    public static final int CMD_FINISHED_EOF

This is the final batch of the file and everything went well on the client side. Server may complete the request.

See Also:
  Constant Field Values

### Constructor Detail

#### JdbcBulkLoadBatchRequest

    public JdbcBulkLoadBatchRequest()

Creates the request with uninitialized parameters.

#### JdbcBulkLoadBatchRequest

    public JdbcBulkLoadBatchRequest(long qryId,
                                    int batchIdx,
                                    int cmd)

Creates the request with specified parameters and zero-length data. Typically used with `CMD_FINISHED_ERROR` and `CMD_FINISHED_EOF`.

Parameters:
  `qryId` - The query ID from the `JdbcBulkLoadAckResult`.
  `batchIdx` - Index of the current batch starting with 0.
  `cmd` - The command (`CMD_CONTINUE`, `CMD_FINISHED_EOF`, or `CMD_FINISHED_ERROR`).

#### JdbcBulkLoadBatchRequest

    public JdbcBulkLoadBatchRequest(long qryId,
                                    int batchIdx,
                                    int cmd,
                                    @NotNull
                                    byte[] data)

Creates the request with the specified parameters.

Parameters:
  `qryId` - The query ID from the `JdbcBulkLoadAckResult`.
  `batchIdx` - Index of the current batch starting with 0.
  `cmd` - The command (`CMD_CONTINUE`, `CMD_FINISHED_EOF`, or `CMD_FINISHED_ERROR`).
  `data` - The data block (zero length is acceptable).

### Method Detail

#### queryId

    public long queryId()

Returns the original query ID.

Returns:
  The original query ID.

#### batchIdx

    public long batchIdx()

Returns the batch index.

Returns:
  The batch index.

#### cmd

    public int cmd()

Returns the command (see CMD_xxx constants for details).

Returns:
  The command.

#### data

    @NotNull
    public byte[] data()

Returns the data.

Returns:
  data if data was not supplied

#### writeBinary

    public void writeBinary(BinaryWriterExImpl writer,
                            ClientListenerProtocolVersion ver)
                     throws BinaryObjectException

Writes fields to provided writer.

Specified by:
  `writeBinary` in interface `JdbcRawBinarylizable`
Overrides:
  `writeBinary` in class `JdbcRequest`
Parameters:
  `writer` - Binary object writer.
  `ver` - ver Protocol version.
Throws:
  `BinaryObjectException` - In case of error.

#### readBinary

    public void readBinary(BinaryReaderExImpl reader,
                           ClientListenerProtocolVersion ver)
                    throws BinaryObjectException

Reads fields from provided reader.

Specified by:
  `readBinary` in interface `JdbcRawBinarylizable`
Overrides:
  `readBinary` in class `JdbcRequest`
Parameters:
  `reader` - Binary object reader.
  `ver` - Protocol version.
Throws:
  `BinaryObjectException` - In case of error.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019