copyIn
Initiates a COPY IN operation allowing manual chunk writing.
The connection stays in copy mode until CopyIn.endCopy or CopyIn.cancelCopy is called, or until CopyIn.writeToCopy reports that the server has ended the copy itself, and no ordinary query can run on it meanwhile. CopyIn is AutoCloseable and cancels on close, so use { } is the safe way to hold one.
Return
The handle to write chunks through.
Parameters
A COPY … FROM STDIN statement.
Throws
UNEXPECTED_RESULT if sql did not start a COPY IN.
Reads all data from the provided InputStream and writes it to the COPY IN operation.
The transfer is aborted if anything goes wrong, so the connection is never left in copy mode. inputStream is not closed — that stays with the caller.
A row the server rejects as it reads it ends the transfer at the next chunk - see CopyIn - and inputStream is read no further, so a bad row early in a large input costs a chunk or two rather than the rest of the input.
Return
The number of rows the server accepted.
Parameters
A COPY … FROM STDIN statement.
The source of the data, read to exhaustion unless the server rejects a row first.
Size of the chunks the input is forwarded in. Each chunk is one message and one flush, so very small values turn a bulk load back into per-chunk round trips.
Throws
INVALID_ARGUMENT if bufferSize is not positive, UNEXPECTED_RESULT if sql did not start a COPY IN.