private String receiveCommandStatus() throws IOException { // TODO: better handle the msg len int l_len = pgStream.receiveInteger4(); // read l_len -5 bytes (-4 for l_len and -1 for trailing \0) String status = pgStream.receiveString(l_len - 5); // now read and discard the trailing \0 pgStream.receiveChar(); // Receive(1) would allocate new byte[1], so avoid it LOGGER.log(Level.FINEST, " <=BE CommandStatus({0})", status); return status; }
private void receiveRFQ() throws IOException { if (pgStream.receiveInteger4() != 5) { throw new IOException("unexpected length of ReadyForQuery message"); } char tStatus = (char) pgStream.receiveChar(); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, " <=BE ReadyForQuery({0})", tStatus); } // Update connection state. switch (tStatus) { case 'I': transactionFailCause = null; setTransactionState(TransactionState.IDLE); break; case 'T': transactionFailCause = null; setTransactionState(TransactionState.OPEN); break; case 'E': setTransactionState(TransactionState.FAILED); break; default: throw new IOException( "unexpected transaction state in ReadyForQuery message: " + (int) tStatus); } }
mechanisms.add(pgStream.receiveString()); } while (pgStream.peekChar() != 0); int c = pgStream.receiveChar(); assert c == 0; if (mechanisms.size() < 1) {
/** * 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); }
c = pgStream.receiveChar(); switch (c) { case 'A': // Asynchronous Notify
public void readStartupMessages() throws IOException, SQLException { for (int i = 0; i < 1000; i++) { int beresp = pgStream.receiveChar(); switch (beresp) { case 'Z':
int beresp = pgStream.receiveChar(); switch (beresp) { case 'E':
int c = pgStream.receiveChar(); switch (c) {
int beresp = pgStream.receiveChar();
int c = pgStream.receiveChar(); switch (c) { case 'A': // Asynchronous Notify
setSocketTimeout(timeoutMillis); int c = pgStream.receiveChar(); if (useTimeout && timeoutMillis >= 0) { setSocketTimeout(0); // Don't timeout after first char
int response = pgStream.receiveChar();