com.foundationdb.sql.jdbc.copy

## Class CopyManager

- java.lang.Object
- - com.foundationdb.sql.jdbc.copy.CopyManager

    public class CopyManager
    extends java.lang.Object

API for PostgreSQL COPY bulk data transfer

### Constructor Summary

Constructors
Constructor and Description
`CopyManager(com.foundationdb.sql.jdbc.core.BaseConnection connection)`

### Method Summary

Methods
`CopyIn` `copyIn(java.lang.String sql)`
`long` `copyIn(java.lang.String sql, java.io.InputStream from)` Use COPY FROM STDIN for very fast copying from an InputStream into a database table.
`long` `copyIn(java.lang.String sql, java.io.InputStream from, int bufferSize)` Use COPY FROM STDIN for very fast copying from an InputStream into a database table.
`long` `copyIn(java.lang.String sql, java.io.Reader from)` Use COPY FROM STDIN for very fast copying from a Reader into a database table.
`long` `copyIn(java.lang.String sql, java.io.Reader from, int bufferSize)` Use COPY FROM STDIN for very fast copying from a Reader into a database table.
`CopyOut` `copyOut(java.lang.String sql)`
`long` `copyOut(java.lang.String sql, java.io.OutputStream to)` Pass results of a COPY TO STDOUT query from database into an OutputStream.
`long` `copyOut(java.lang.String sql, java.io.Writer to)` Pass results of a COPY TO STDOUT query from database into a Writer.

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

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

### Constructor Detail

#### CopyManager

    public CopyManager(com.foundationdb.sql.jdbc.core.BaseConnection connection)
                throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

### Method Detail

#### copyIn

    public CopyIn copyIn(java.lang.String sql)
                  throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### copyOut

    public CopyOut copyOut(java.lang.String sql)
                    throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### copyOut

    public long copyOut(java.lang.String sql,
               java.io.Writer to)
                 throws java.sql.SQLException,
                        java.io.IOException

Pass results of a COPY TO STDOUT query from database into a Writer.

Parameters:
  `sql` - COPY TO STDOUT statement
  `to` - the stream to write the results to (row by row)
Returns:
  number of rows updated for server 8.2 or newer; -1 for older
Throws:
  `java.sql.SQLException` - on database usage errors
  `java.io.IOException` - upon writer or database connection failure

#### copyOut

    public long copyOut(java.lang.String sql,
               java.io.OutputStream to)
                 throws java.sql.SQLException,
                        java.io.IOException

Pass results of a COPY TO STDOUT query from database into an OutputStream.

Parameters:
  `sql` - COPY TO STDOUT statement
  `to` - the stream to write the results to (row by row)
Returns:
  number of rows updated for server 8.2 or newer; -1 for older
Throws:
  `java.sql.SQLException` - on database usage errors
  `java.io.IOException` - upon output stream or database connection failure

#### copyIn

    public long copyIn(java.lang.String sql,
              java.io.Reader from)
                throws java.sql.SQLException,
                       java.io.IOException

Use COPY FROM STDIN for very fast copying from a Reader into a database table.

Parameters:
  `sql` - COPY FROM STDIN statement
  `from` - a CSV file or such
Returns:
  number of rows updated for server 8.2 or newer; -1 for older
Throws:
  `java.sql.SQLException` - on database usage issues
  `java.io.IOException` - upon reader or database connection failure

#### copyIn

    public long copyIn(java.lang.String sql,
              java.io.Reader from,
              int bufferSize)
                throws java.sql.SQLException,
                       java.io.IOException

Use COPY FROM STDIN for very fast copying from a Reader into a database table.

Parameters:
  `sql` - COPY FROM STDIN statement
  `from` - a CSV file or such
  `bufferSize` - number of characters to buffer and push over network to server at once
Returns:
  number of rows updated for server 8.2 or newer; -1 for older
Throws:
  `java.sql.SQLException` - on database usage issues
  `java.io.IOException` - upon reader or database connection failure

#### copyIn

    public long copyIn(java.lang.String sql,
              java.io.InputStream from)
                throws java.sql.SQLException,
                       java.io.IOException

Use COPY FROM STDIN for very fast copying from an InputStream into a database table.

Parameters:
  `sql` - COPY FROM STDIN statement
  `from` - a CSV file or such
Returns:
  number of rows updated for server 8.2 or newer; -1 for older
Throws:
  `java.sql.SQLException` - on database usage issues
  `java.io.IOException` - upon input stream or database connection failure

#### copyIn

    public long copyIn(java.lang.String sql,
              java.io.InputStream from,
              int bufferSize)
                throws java.sql.SQLException,
                       java.io.IOException

Use COPY FROM STDIN for very fast copying from an InputStream into a database table.

Parameters:
  `sql` - COPY FROM STDIN statement
  `from` - a CSV file or such
  `bufferSize` - number of bytes to buffer and push over network to server at once
Returns:
  number of rows updated for server 8.2 or newer; -1 for older
Throws:
  `java.sql.SQLException` - on database usage issues
  `java.io.IOException` - upon input stream or database connection failure