PSQLState.OBJECT_NOT_IN_STATE); op.handleCommandStatus(status); } catch (SQLException se) { error = se; PSQLState.COMMUNICATION_ERROR); } else { op.handleCopydata(buf);
/** * Locks connection and calls initializer for a new CopyOperation Called via startCopy -> * processCopyResults. * * @param op an uninitialized CopyOperation * @throws SQLException on locking failure * @throws IOException on database connection failure */ private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException { pgStream.receiveInteger4(); // length not used int rowFormat = pgStream.receiveChar(); int numFields = pgStream.receiveInteger2(); int[] fieldFormats = new int[numFields]; for (int i = 0; i < numFields; i++) { fieldFormats[i] = pgStream.receiveInteger2(); } lock(op); op.init(this, rowFormat, fieldFormats); }
/** * 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); } }
if(op == null) throw new PSQLException(GT.tr("Received CommandComplete ''{0}'' without an active copy operation", status), PSQLState.OBJECT_NOT_IN_STATE); op.handleCommandStatus(status); } catch(SQLException se) { error = se;
if(op == null) throw new PSQLException(GT.tr("Received CommandComplete ''{0}'' without an active copy operation", status), PSQLState.OBJECT_NOT_IN_STATE); op.handleCommandStatus(status); } catch(SQLException se) { error = se;
/** * Locks connection and calls initializer for a new CopyOperation * Called via startCopy -> processCopyResults * @param op an unitialized CopyOperation * @throws SQLException on locking failure * @throws IOException on database connection failure */ private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException { pgStream.ReceiveInteger4(); // length not used int rowFormat = pgStream.ReceiveChar(); int numFields = pgStream.ReceiveInteger2(); int[] fieldFormats = new int[numFields]; for(int i=0; i<numFields; i++) fieldFormats[i] = pgStream.ReceiveInteger2(); lock(op); op.init(this, rowFormat, fieldFormats); }
if(op == null) throw new PSQLException(GT.tr("Received CommandComplete ''{0}'' without an active copy operation", status), PSQLState.OBJECT_NOT_IN_STATE); op.handleCommandStatus(status); } catch(SQLException se) { error = se;
/** * Locks connection and calls initializer for a new CopyOperation * Called via startCopy -> processCopyResults * @param op an unitialized CopyOperation * @throws SQLException on locking failure * @throws IOException on database connection failure */ private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException { pgStream.ReceiveInteger4(); // length not used int rowFormat = pgStream.ReceiveChar(); int numFields = pgStream.ReceiveInteger2(); int[] fieldFormats = new int[numFields]; for(int i=0; i<numFields; i++) fieldFormats[i] = pgStream.ReceiveInteger2(); lock(op); op.init(this, rowFormat, fieldFormats); }
/** * Locks connection and calls initializer for a new CopyOperation * Called via startCopy -> processCopyResults * @param op an unitialized CopyOperation * @throws SQLException on locking failure * @throws IOException on database connection failure */ private synchronized void initCopy(CopyOperationImpl op) throws SQLException, IOException { pgStream.ReceiveInteger4(); // length not used int rowFormat = pgStream.ReceiveChar(); int numFields = pgStream.ReceiveInteger2(); int[] fieldFormats = new int[numFields]; for(int i=0; i<numFields; i++) fieldFormats[i] = pgStream.ReceiveInteger2(); lock(op); op.init(this, rowFormat, fieldFormats); }