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

## Class JdbcBulkLoadProcessor

- java.lang.Object
- - org.apache.ignite.internal.processors.odbc.jdbc.JdbcBulkLoadProcessor

    public class JdbcBulkLoadProcessor
    extends Object

JDBC wrapper around `BulkLoadProcessor` that provides extra logic. Unlike other "single shot" request-reply commands, the COPY command the client-server interaction looks like this:

     Thin JDBC client                            Server
            |                                       |
            |------- JdbcQueryExecuteRequest ------>|
            |         with SQL copy command         |
            |                                       |
            |<---- JdbcBulkLoadAckResult -----------|
            | with BulkLoadAckClientParameters      |
            | containing file name and batch size.  |
            |                                       |
     (open the file,                                |
      read portions and send them)                  |
            |                                       |
            |------- JdbcBulkLoadBatchRequest #1 -->|
            | with a portion of input file.         |
            |                                       |
            |<--- JdbcQueryExecuteResult -----------|
            | with current update counter.          |
            |                                       |
            |------- JdbcBulkLoadBatchRequest #2--->|
            | with a portion of input file.         |
            |                                       |
            |<--- JdbcQueryExecuteResult -----------|
            | with current update counter.          |
            |                                       |
            |------- JdbcBulkLoadBatchRequest #3--->|
            | with the LAST portion of input file.  |
            |                                       |
            |<--- JdbcQueryExecuteResult -----------|
            | with the final update counter.        |
            |                                       |
     (close the file)                               |
            |                                       |

In case of input file reading error, a flag is carried to the server: `JdbcBulkLoadBatchRequest.CMD_FINISHED_ERROR` and the processing is aborted on the both sides.

### Field Summary

Fields
`protected long` `nextBatchIdx` Next batch index (for a very simple check that all batches were delivered to us).

### Constructor Summary

Constructors
Constructor and Description
`JdbcBulkLoadProcessor(BulkLoadProcessor processor)` Creates a JDBC-specific adapter for bulk load processor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Closes the underlying objects.
`void` `processBatch(JdbcBulkLoadBatchRequest req)` Completely processes a bulk load batch request.
`long` `updateCnt()` Provides update counter for sending in the `JdbcBatchExecuteResult`.

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

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

### Field Detail

#### nextBatchIdx

    protected long nextBatchIdx

Next batch index (for a very simple check that all batches were delivered to us).

### Constructor Detail

#### JdbcBulkLoadProcessor

    public JdbcBulkLoadProcessor(BulkLoadProcessor processor)

Creates a JDBC-specific adapter for bulk load processor.

Parameters:
  `processor` - Bulk load processor from the core to delegate calls to.

### Method Detail

#### processBatch

    public void processBatch(JdbcBulkLoadBatchRequest req)
                      throws IgniteCheckedException

Completely processes a bulk load batch request. Calls `BulkLoadProcessor` wrapping around some JDBC-specific logic (commands, bulk load batch index checking).

Parameters:
  `req` - The current request.
Throws:
  `IgniteCheckedException`

#### close

    public void close()
               throws Exception

Closes the underlying objects. Currently we don't handle normal termination vs. abort.

Throws:
  `Exception`

#### updateCnt

    public long updateCnt()

Provides update counter for sending in the `JdbcBatchExecuteResult`.

Returns:
  The update counter for sending in `JdbcBatchExecuteResult`.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.6.0
Release Date | : July 10 2018