Tabnine Logo
QueryExecutorImpl.processCopyResults
Code IndexAdd Tabnine to your IDE (free)

How to use
processCopyResults
method
in
org.postgresql.core.v3.QueryExecutorImpl

Best Java code snippets using org.postgresql.core.v3.QueryExecutorImpl.processCopyResults (Showing top 20 results out of 315)

origin: postgresql/postgresql

public synchronized void flushCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    pgStream.flush();
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: postgresql/postgresql

/**
 * Blocks to wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation
 * @param op the copy operation presumably currently holding lock on this connection
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOutImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    processCopyResults(op, true); // expect a call to handleCopydata() to store the data
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.postgresql/postgresql

public synchronized void flushCopy(CopyOperationImpl op) throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"),
    PSQLState.OBJECT_NOT_IN_STATE);
 }
 try {
  pgStream.flush();
  processCopyResults(op, false); // collect any pending notifications without blocking
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when writing to copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: org.postgresql/postgresql

/**
 * Wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation.
 *
 * @param op the copy operation presumably currently holding lock on this connection
 * @param block whether to block waiting for input
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOperationImpl op, boolean block) throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to read from inactive copy"),
    PSQLState.OBJECT_NOT_IN_STATE);
 }
 try {
  processCopyResults(op, block); // expect a call to handleCopydata() to store the data
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when reading from copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: org.postgresql/postgresql

/**
 * Sends data during a live COPY IN operation. Only unlocks the connection if server suddenly
 * returns CommandComplete, which should not happen
 *
 * @param op the CopyIn operation presumably currently holding lock on this connection
 * @param data bytes to send
 * @param off index of first byte to send (usually 0)
 * @param siz number of bytes to send (usually data.length)
 * @throws SQLException on failure
 */
public synchronized void writeToCopy(CopyOperationImpl op, byte[] data, int off, int siz)
  throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"),
    PSQLState.OBJECT_NOT_IN_STATE);
 }
 LOGGER.log(Level.FINEST, " FE=> CopyData({0})", siz);
 try {
  pgStream.sendChar('d');
  pgStream.sendInteger4(siz + 4);
  pgStream.send(data, off, siz);
  processCopyResults(op, false); // collect any pending notifications without blocking
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when writing to copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: org.postgresql/postgresql

/**
 * Finishes writing to copy and unlocks connection.
 *
 * @param op the copy operation presumably currently holding lock on this connection
 * @return number of rows updated for server versions 8.2 or newer
 * @throws SQLException on failure
 */
public synchronized long endCopy(CopyOperationImpl op) throws SQLException {
 if (!hasLock(op)) {
  throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
 }
 try {
  LOGGER.log(Level.FINEST, " FE=> CopyDone");
  pgStream.sendChar('c'); // CopyDone
  pgStream.sendInteger4(4);
  pgStream.flush();
  do {
   processCopyResults(op, true);
  } while (hasLock(op));
  return op.getHandledRowCount();
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when ending copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: org.postgresql/postgresql

/**
 * Sends given query to BE to start, initialize and lock connection for a CopyOperation.
 *
 * @param sql COPY FROM STDIN / COPY TO STDOUT statement
 * @return CopyIn or CopyOut operation object
 * @throws SQLException on failure
 */
public synchronized CopyOperation startCopy(String sql, boolean suppressBegin)
  throws SQLException {
 waitOnLock();
 if (!suppressBegin) {
  doSubprotocolBegin();
 }
 byte[] buf = Utils.encodeUTF8(sql);
 try {
  LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)");
  pgStream.sendChar('Q');
  pgStream.sendInteger4(buf.length + 4 + 1);
  pgStream.send(buf);
  pgStream.sendChar(0);
  pgStream.flush();
  return processCopyResults(null, true);
  // expect a CopyInResponse or CopyOutResponse to our query above
 } catch (IOException ioe) {
  throw new PSQLException(GT.tr("Database connection failed when starting copy"),
    PSQLState.CONNECTION_FAILURE, ioe);
 }
}
origin: postgresql/postgresql

/**
 * Sends data during a live COPY IN operation. Only unlocks the connection if server
 * suddenly returns CommandComplete, which should not happen
 * @param op the CopyIn operation presumably currently holding lock on this connection
 * @param data bytes to send
 * @param off index of first byte to send (usually 0)
 * @param siz number of bytes to send (usually data.length)
 * @throws SQLException on failure
 */
public synchronized void writeToCopy(CopyInImpl op, byte[] data, int off, int siz) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  if (logger.logDebug())
    logger.debug(" FE=> CopyData(" + siz + ")");
  try {
    pgStream.SendChar('d');
    pgStream.SendInteger4(siz + 4);
    pgStream.Send(data, off, siz);
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: postgresql/postgresql

/**
 * Finishes writing to copy and unlocks connection
 * @param op the copy operation presumably currently holding lock on this connection
 * @return number of rows updated for server versions 8.2 or newer
 * @throws SQLException on failure
 */
public synchronized long endCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
      throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    if (logger.logDebug())
      logger.debug(" FE=> CopyDone");
    pgStream.SendChar('c'); // CopyDone
    pgStream.SendInteger4(4);
    pgStream.flush();
    processCopyResults(op, true);
    return op.getHandledRowCount();
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when ending copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: postgresql/postgresql

/**
 * Sends given query to BE to start, initialize and lock connection for a CopyOperation.
 * @param sql COPY FROM STDIN / COPY TO STDOUT statement
 * @return CopyIn or CopyOut operation object
 * @throws SQLException on failure
 */
public synchronized CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException {
  waitOnLock();
  if (!suppressBegin) {
    doSubprotocolBegin();
  }
  byte buf[] = Utils.encodeUTF8(sql);
  try {
    if (logger.logDebug())
      logger.debug(" FE=> Query(CopyStart)");
    pgStream.SendChar('Q');
    pgStream.SendInteger4(buf.length + 4 + 1);
    pgStream.Send(buf);
    pgStream.SendChar(0);
    pgStream.flush();
    return processCopyResults(null, true); // expect a CopyInResponse or CopyOutResponse to our query above
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when starting copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.postgresql/postgresql

do {
 try {
  processCopyResults(op, true); // discard rest of input
 } catch (SQLException se) { // expected error response to failing copy
  errors++;
origin: postgresql/postgresql

do {
  try {
    processCopyResults(op, true); // discard rest of input
  } catch(SQLException se) { // expected error response to failing copy
    errors++;
origin: org.ancoron.postgresql/org.postgresql

/**
 * Blocks to wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation
 * @param op the copy operation presumably currently holding lock on this connection
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOutImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    processCopyResults(op, true); // expect a call to handleCopydata() to store the data
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * Blocks to wait for a row of data to be received from server on an active copy operation
 * Connection gets unlocked by processCopyResults() at end of operation
 * @param op the copy operation presumably currently holding lock on this connection
 * @throws SQLException on any failure
 */
synchronized void readFromCopy(CopyOutImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to read from inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    processCopyResults(op, true); // expect a call to handleCopydata() to store the data
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when reading from copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql

public synchronized void flushCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    pgStream.flush();
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql.osgi

public synchronized void flushCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    pgStream.flush();
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * Finishes writing to copy and unlocks connection
 * @param op the copy operation presumably currently holding lock on this connection
 * @return number of rows updated for server versions 8.2 or newer
 * @throws SQLException on failure
 */
public synchronized long endCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
      throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    pgStream.SendChar('c'); // CopyDone
    pgStream.SendInteger4(4);
    pgStream.flush();
    processCopyResults(op, true);
    return op.getHandledRowCount();
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when ending copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * Sends data during a live COPY IN operation. Only unlocks the connection if server
 * suddenly returns CommandComplete, which should not happen
 * @param op the CopyIn operation presumably currently holding lock on this connection
 * @param data bytes to send
 * @param off index of first byte to send (usually 0)
 * @param siz number of bytes to send (usually data.length)
 * @throws SQLException on failure
 */
public synchronized void writeToCopy(CopyInImpl op, byte[] data, int off, int siz) throws SQLException {
  if(!hasLock(op))
    throw new PSQLException(GT.tr("Tried to write to an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE);
  if (logger.logDebug())
    logger.debug(" FE=> CopyData(" + (siz-off) + ")");
  try {
    pgStream.SendChar('d');
    pgStream.SendInteger4(siz + 4);
    pgStream.Send(data, off, siz);
    processCopyResults(op, false); // collect any pending notifications without blocking
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when writing to copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql

/**
 * Finishes writing to copy and unlocks connection
 * @param op the copy operation presumably currently holding lock on this connection
 * @return number of rows updated for server versions 8.2 or newer
 * @throws SQLException on failure
 */
public synchronized long endCopy(CopyInImpl op) throws SQLException {
  if(!hasLock(op))
      throw new PSQLException(GT.tr("Tried to end inactive copy"), PSQLState.OBJECT_NOT_IN_STATE);
  try {
    if (logger.logDebug())
      logger.debug(" FE=> CopyDone");
    pgStream.SendChar('c'); // CopyDone
    pgStream.SendInteger4(4);
    pgStream.flush();
    processCopyResults(op, true);
    return op.getHandledRowCount();
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when ending copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
origin: org.ancoron.postgresql/org.postgresql

/**
 * Sends given query to BE to start, initialize and lock connection for a CopyOperation.
 * @param sql COPY FROM STDIN / COPY TO STDOUT statement
 * @return CopyIn or CopyOut operation object
 * @throws SQLException on failure
 */
public synchronized CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException {
  waitOnLock();
  if (!suppressBegin) {
    doSubprotocolBegin();
  }
  byte buf[] = Utils.encodeUTF8(sql);
  try {
    if (logger.logDebug())
      logger.debug(" FE=> Query(CopyStart)");
    pgStream.SendChar('Q');
    pgStream.SendInteger4(buf.length + 4 + 1);
    pgStream.Send(buf);
    pgStream.SendChar(0);
    pgStream.flush();
    return processCopyResults(null, true); // expect a CopyInResponse or CopyOutResponse to our query above
  } catch(IOException ioe) {
    throw new PSQLException(GT.tr("Database connection failed when starting copy"), PSQLState.CONNECTION_FAILURE, ioe);
  }
}
org.postgresql.core.v3QueryExecutorImplprocessCopyResults

Javadoc

Handles copy sub protocol responses from server. Unlocks at end of sub protocol, so operations on pgStream or QueryExecutor are not allowed in a method after calling this!

Popular methods of QueryExecutorImpl

  • <init>
  • cancelCopy
    Finishes a copy operation and unlocks connection discarding any exchanged data.
  • doSubprotocolBegin
  • endCopy
    Finishes writing to copy and unlocks connection.
  • flushCopy
  • hasLock
  • initCopy
    Locks connection and calls initializer for a new CopyOperation Called via startCopy -> processCopyRe
  • interpretCommandStatus
  • lock
    Obtain lock over this connection for given object, blocking to wait if necessary.
  • processDeadParsedQueries
  • processDeadPortals
  • processResults
  • processDeadPortals,
  • processResults,
  • readFromCopy,
  • receiveAsyncNotify,
  • receiveCommandStatus,
  • receiveErrorResponse,
  • receiveFastpathResult,
  • receiveFields,
  • receiveNoticeResponse

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Collectors (java.util.stream)
  • JList (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now