/** * Ignore the response message by reading the message length and skipping * over those bytes in the communication stream. */ private void skipMessage() throws IOException { int l_len = pgStream.ReceiveInteger4(); // skip l_len-4 (length includes the 4 bytes for message length itself pgStream.Skip(l_len - 4); }
int l_msgSize = ReceiveInteger4(); int i; int l_nf = ReceiveInteger2(); for (i = 0 ; i < l_nf ; ++i) int l_size = ReceiveInteger4(); if (l_size != -1) { try {
private void receiveAsyncNotify() throws IOException { int msglen = pgStream.ReceiveInteger4(); int pid = pgStream.ReceiveInteger4(); String msg = pgStream.ReceiveString(); String param = pgStream.ReceiveString(); protoConnection.addNotification(new org.postgresql.core.Notification(msg, pid, param)); if (logger.logDebug()) logger.debug(" <=BE AsyncNotify(" + pid + "," + msg + "," + param + ")"); }
private Field[] receiveFields() throws IOException { int l_msgSize = pgStream.ReceiveInteger4(); int size = pgStream.ReceiveInteger2(); Field[] fields = new Field[size]; if (logger.logDebug()) logger.debug(" <=BE RowDescription(" + size + ")"); for (int i = 0; i < fields.length; i++) { String columnLabel = pgStream.ReceiveString(); int tableOid = pgStream.ReceiveInteger4(); short positionInTable = (short)pgStream.ReceiveInteger2(); int typeOid = pgStream.ReceiveInteger4(); int typeLength = pgStream.ReceiveInteger2(); int typeModifier = pgStream.ReceiveInteger4(); int formatType = pgStream.ReceiveInteger2(); fields[i] = new Field(columnLabel, "", /* name not yet determined */ typeOid, typeLength, typeModifier, tableOid, positionInTable); fields[i].setFormat(formatType); } return fields; }
private Field[] receiveFields() throws IOException { int size = pgStream.ReceiveInteger2(); Field[] fields = new Field[size]; if (logger.logDebug()) logger.debug(" <=BE RowDescription(" + fields.length + ")"); for (int i = 0; i < fields.length; i++) { String columnLabel = pgStream.ReceiveString(); int typeOid = pgStream.ReceiveInteger4(); int typeLength = pgStream.ReceiveInteger2(); int typeModifier = pgStream.ReceiveInteger4(); fields[i] = new Field(columnLabel, columnLabel, typeOid, typeLength, typeModifier, 0, 0); } return fields; }
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.Receive(1); if (logger.logDebug()) logger.debug(" <=BE CommandStatus(" + 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.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 receiveAsyncNotify() throws IOException { int pid = pgStream.ReceiveInteger4(); String msg = pgStream.ReceiveString(); if (logger.logDebug()) logger.debug(" <=BE AsyncNotify(pid=" + pid + ",msg=" + msg + ")"); protoConnection.addNotification(new org.postgresql.core.Notification(msg, pid)); }
int len = ReceiveInteger4(); if (!bin) len -= 4;
/** * 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); }
private SQLException receiveErrorResponse() throws IOException { // it's possible to get more than one error message for a query // see libpq comments wrt backend closing a connection // so, append messages to a string buffer and keep processing // check at the bottom to see if we need to throw an exception int elen = pgStream.ReceiveInteger4(); String totalMessage = pgStream.ReceiveString(elen - 4); ServerErrorMessage errorMsg = new ServerErrorMessage(totalMessage, logger.getLogLevel()); if (logger.logDebug()) logger.debug(" <=BE ErrorMessage(" + errorMsg.toString() + ")"); return new PSQLException(errorMsg); }
private SQLWarning receiveNoticeResponse() throws IOException { int nlen = pgStream.ReceiveInteger4(); ServerErrorMessage warnMsg = new ServerErrorMessage(pgStream.ReceiveString(nlen - 4), logger.getLogLevel()); if (logger.logDebug()) logger.debug(" <=BE NoticeResponse(" + warnMsg.toString() + ")"); return new PSQLWarning(warnMsg); }
int msgLen = pgStream.ReceiveInteger4(); int valueLen = pgStream.ReceiveInteger4();
if (pgStream.ReceiveInteger4() != 5) throw new IOException("unexpected length of ReadyForQuery packet"); int l_msgLen = pgStream.ReceiveInteger4(); if (l_msgLen != 12) throw new PSQLException(GT.tr("Protocol error. Session setup failed."), PSQLState.PROTOCOL_VIOLATION); int pid = pgStream.ReceiveInteger4(); int ckey = pgStream.ReceiveInteger4(); int l_elen = pgStream.ReceiveInteger4(); ServerErrorMessage l_errorMsg = new ServerErrorMessage(pgStream.ReceiveString(l_elen - 4), logger.getLogLevel()); int l_nlen = pgStream.ReceiveInteger4(); ServerErrorMessage l_warnMsg = new ServerErrorMessage(pgStream.ReceiveString(l_nlen - 4), logger.getLogLevel()); int l_len = pgStream.ReceiveInteger4(); String name = pgStream.ReceiveString(); String value = pgStream.ReceiveString();
int len = pgStream.ReceiveInteger4(); result = pgStream.Receive(len); c = pgStream.ReceiveChar();
int pid = pgStream.ReceiveInteger4(); int ckey = pgStream.ReceiveInteger4(); if (logger.logDebug()) logger.debug(" <=BE BackendKeyData(pid=" + pid + ",ckey=" + ckey + ")");
int l_elen = pgStream.ReceiveInteger4(); ServerErrorMessage l_errorMsg = new ServerErrorMessage(pgStream.ReceiveString(l_elen - 4), logger.getLogLevel()); logger.debug(" <=BE AuthenticationGSSContinue"); int len = pgStream.ReceiveInteger4(); int type = pgStream.ReceiveInteger4();
int l_elen = pgStream.ReceiveInteger4(); if (l_elen > 30000) int l_msgLen = pgStream.ReceiveInteger4(); int areq = pgStream.ReceiveInteger4();
int areq = pgStream.ReceiveInteger4();
logger.debug(" <=BE CopyData"); len = pgStream.ReceiveInteger4() - 4; byte[] buf = pgStream.Receive(len); if(op == null) { logger.debug(" <=BE CopyDone"); len = pgStream.ReceiveInteger4() - 4; if(len > 0)