パッケージ org.postgresql.core.v3

クラス CopyInImpl

すべての実装されたインタフェース:
CopyIn, CopyOperation

public class CopyInImpl extends CopyOperationImpl implements CopyIn

COPY FROM STDIN operation.

Anticipated flow: CopyManager.copyIn() ->QueryExecutor.startCopy() - sends given query to server ->processCopyResults(): - receives CopyInResponse from Server - creates new CopyInImpl ->initCopy(): - receives copy metadata from server ->CopyInImpl.init() ->lock() connection for this operation - if query fails an exception is thrown - if query returns wrong CopyOperation, copyIn() cancels it before throwing exception <-return: new CopyInImpl holding lock on connection repeat CopyIn.writeToCopy() for all data ->CopyInImpl.writeToCopy() ->QueryExecutorImpl.writeToCopy() - sends given data ->processCopyResults() - parameterized not to block, just peek for new messages from server - on ErrorResponse, waits until protocol is restored and unlocks connection CopyIn.endCopy() ->CopyInImpl.endCopy() ->QueryExecutorImpl.endCopy() - sends CopyDone - processCopyResults() - on CommandComplete ->CopyOperationImpl.handleCommandComplete() - sets updatedRowCount when applicable - on ReadyForQuery unlock() connection for use by other operations <-return: CopyInImpl.getUpdatedRowCount()

  • コンストラクタの詳細

    • CopyInImpl

      public CopyInImpl()
  • メソッドの詳細

    • writeToCopy

      public void writeToCopy(byte[] data, int off, int siz) throws SQLException
      インタフェースからコピーされた説明: CopyIn
      Writes specified part of given byte array to an open and writable copy operation.
      定義:
      writeToCopy インタフェース内 CopyIn
      パラメータ:
      data - array of bytes to write
      off - offset of first byte to write (normally zero)
      siz - number of bytes to write (normally buf.length)
      例外:
      SQLException - if the operation fails
    • writeToCopy

      public void writeToCopy(ByteStreamWriter from) throws SQLException
      インタフェースからコピーされた説明: CopyIn
      Writes a ByteStreamWriter to an open and writable copy operation.
      定義:
      writeToCopy インタフェース内 CopyIn
      パラメータ:
      from - the source of bytes, e.g. a ByteBufferByteStreamWriter
      例外:
      SQLException - if the operation fails
    • flushCopy

      public void flushCopy() throws SQLException
      インタフェースからコピーされた説明: CopyIn
      Force any buffered output to be sent over the network to the backend. In general this is a useless operation as it will get pushed over in due time or when endCopy is called. Some specific modified server versions (Truviso) want this data sooner. If you are unsure if you need to use this method, don't.
      定義:
      flushCopy インタフェース内 CopyIn
      例外:
      SQLException - if the operation fails.
    • endCopy

      public long endCopy() throws SQLException
      インタフェースからコピーされた説明: CopyIn
      Finishes copy operation successfully.
      定義:
      endCopy インタフェース内 CopyIn
      戻り値:
      number of updated rows for server 8.2 or newer (see getHandledRowCount())
      例外:
      SQLException - if the operation fails.
    • handleCopydata

      protected void handleCopydata(byte[] data) throws PSQLException
      クラスからコピーされた説明: CopyOperationImpl
      Consume received copy data.
      定義:
      handleCopydata クラス内 CopyOperationImpl
      パラメータ:
      data - data that was receive by copy protocol
      例外:
      PSQLException - if some internal problem occurs