private void receiveRFQ() throws IOException { if (pgStream.ReceiveInteger4() != 5) throw new IOException("unexpected length of ReadyForQuery message"); char tStatus = (char)pgStream.ReceiveChar(); if (logger.logDebug()) logger.debug(" <=BE ReadyForQuery(" + tStatus + ")"); // Update connection state. switch (tStatus) { case 'I': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_IDLE); break; case 'T': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_OPEN); break; case 'E': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_FAILED); break; default: throw new IOException("unexpected transaction state in ReadyForQuery message: " + (int)tStatus); } }
/** * 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); }
int c = pgStream.ReceiveChar(); c = pgStream.ReceiveChar(); if (c == 'G') c = pgStream.ReceiveChar();
public synchronized void processNotifies() throws SQLException { // Asynchronous notifies only arrive when we are not in a transaction if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) return; try { while (pgStream.hasMessagePending()) { int c = pgStream.ReceiveChar(); switch (c) { case 'A': // Asynchronous Notify receiveAsyncNotify(); break; case 'E': // Error Message throw receiveErrorMessage(); // break; case 'N': // Error Notification protoConnection.addWarning(receiveNotification()); break; default: throw new PSQLException(GT.tr("Unknown Response Type {0}.", new Character((char) c)), PSQLState.CONNECTION_FAILURE); } } } catch (IOException ioe) { throw new PSQLException(GT.tr("An I/O error occured while sending to the backend."), PSQLState.CONNECTION_FAILURE, ioe); } }
public synchronized void processNotifies() throws SQLException { waitOnLock(); // Asynchronous notifies only arrive when we are not in a transaction if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE) return; try { while (pgStream.hasMessagePending()) { int c = pgStream.ReceiveChar(); switch (c) { case 'A': // Asynchronous Notify receiveAsyncNotify(); break; case 'E': // Error Response (response to pretty much everything; backend then skips until Sync) throw receiveErrorResponse(); // break; case 'N': // Notice Response (warnings / info) SQLWarning warning = receiveNoticeResponse(); protoConnection.addWarning(warning); break; default: throw new PSQLException(GT.tr("Unknown Response Type {0}.", new Character((char) c)), PSQLState.CONNECTION_FAILURE); } } } catch (IOException ioe) { throw new PSQLException(GT.tr("An I/O error occured while sending to the backend."), PSQLState.CONNECTION_FAILURE, ioe); } }
while (!endQuery) int c = pgStream.ReceiveChar(); if (logger.logDebug()) logger.debug(" <=BE EmptyQuery"); c = pgStream.ReceiveChar(); if (c != 0) throw new IOException("Expected \\0 after EmptyQuery, got: " + c);
int c = pgStream.ReceiveChar(); switch (c)
c = pgStream.ReceiveChar(); switch (c)
private void readStartupMessages(PGStream pgStream, ProtocolConnectionImpl protoConnection, Logger logger) throws IOException, SQLException { while (true) int beresp = pgStream.ReceiveChar(); switch (beresp) throw new IOException("unexpected length of ReadyForQuery packet"); char tStatus = (char)pgStream.ReceiveChar(); if (logger.logDebug()) logger.debug(" <=BE ReadyForQuery(" + tStatus + ")");
int beresp = pgStream.ReceiveChar();
int beresp = pgStream.ReceiveChar();
int c = pgStream.ReceiveChar(); switch(c) {
private void readStartupMessages(PGStream pgStream, ProtocolConnectionImpl protoConnection, Logger logger) throws IOException, SQLException { while (true) int beresp = pgStream.ReceiveChar(); switch (beresp)
int response = pgStream.ReceiveChar();
int beresp = pgStream.ReceiveChar(); switch (beresp)
int beresp = pgStream.ReceiveChar(); switch (beresp)
private void receiveRFQ() throws IOException { if (pgStream.ReceiveInteger4() != 5) throw new IOException("unexpected length of ReadyForQuery message"); char tStatus = (char)pgStream.ReceiveChar(); if (logger.logDebug()) logger.debug(" <=BE ReadyForQuery(" + tStatus + ")"); // Update connection state. switch (tStatus) { case 'I': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_IDLE); break; case 'T': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_OPEN); break; case 'E': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_FAILED); break; default: throw new IOException("unexpected transaction state in ReadyForQuery message: " + (int)tStatus); } }
private void receiveRFQ() throws IOException { if (pgStream.ReceiveInteger4() != 5) throw new IOException("unexpected length of ReadyForQuery message"); char tStatus = (char)pgStream.ReceiveChar(); if (logger.logDebug()) logger.debug(" <=BE ReadyForQuery(" + tStatus + ")"); // Update connection state. switch (tStatus) { case 'I': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_IDLE); break; case 'T': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_OPEN); break; case 'E': protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_FAILED); break; default: throw new IOException("unexpected transaction state in ReadyForQuery message: " + (int)tStatus); } }
/** * 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); }