|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.postgresql.core.v3.CopyOperationImpl
org.postgresql.core.v3.CopyInImpl
public class CopyInImpl
Anticipated flow of a COPY FROM STDIN operation: 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()
| Constructor Summary | |
|---|---|
CopyInImpl()
|
|
| Method Summary | |
|---|---|
long |
endCopy()
Finishes copy operation succesfully. |
void |
flushCopy()
Force any buffered output to be sent over the network to the backend. |
protected void |
handleCopydata(byte[] data)
Consume received copy data |
void |
writeToCopy(byte[] data,
int off,
int siz)
Writes specified part of given byte array to an open and writable copy operation. |
| Methods inherited from class org.postgresql.core.v3.CopyOperationImpl |
|---|
cancelCopy, getFieldCount, getFieldFormat, getFormat, getHandledRowCount, handleCommandStatus, isActive |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.postgresql.copy.CopyOperation |
|---|
cancelCopy, getFieldCount, getFieldFormat, getFormat, getHandledRowCount, isActive |
| Constructor Detail |
|---|
public CopyInImpl()
| Method Detail |
|---|
public void writeToCopy(byte[] data,
int off,
int siz)
throws SQLException
CopyIn
writeToCopy in interface CopyIndata - array of bytes to writeoff - offset of first byte to write (normally zero)siz - number of bytes to write (normally buf.length)
SQLException - if the operation fails
public void flushCopy()
throws SQLException
CopyIn
flushCopy in interface CopyInSQLException - if the operation fails.
public long endCopy()
throws SQLException
CopyIn
endCopy in interface CopyInSQLException - if the operation fails.
protected void handleCopydata(byte[] data)
throws PSQLException
CopyOperationImpl
handleCopydata in class CopyOperationImpldata - data that was receive by copy protocol
PSQLException - if some internal problem occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||