private SQLWarning receiveNotification() throws IOException { String warnMsg = pgStream.ReceiveString(); // Strip out the severity field so we have consistency with // the V3 protocol. SQLWarning.getMessage should return just // the actual message. // int severityMark = warnMsg.indexOf(":"); warnMsg = warnMsg.substring(severityMark+1).trim(); if (logger.logDebug()) logger.debug(" <=BE NoticeResponse(" + warnMsg + ")"); return new SQLWarning(warnMsg); }
private SQLException receiveErrorMessage() throws IOException { String errorMsg = pgStream.ReceiveString().trim(); if (logger.logDebug()) logger.debug(" <=BE ErrorResponse(" + errorMsg + ")"); return new PSQLException(errorMsg, PSQLState.UNKNOWN_STATE); }
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 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 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)); }
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); }
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; }
String status = pgStream.ReceiveString(); String portalName = pgStream.ReceiveString(); if (logger.logDebug()) logger.debug(" <=BE PortalName(" + portalName + ")");
ServerErrorMessage l_errorMsg = new ServerErrorMessage(pgStream.ReceiveString(l_elen - 4), logger.getLogLevel()); ServerErrorMessage l_warnMsg = new ServerErrorMessage(pgStream.ReceiveString(l_nlen - 4), logger.getLogLevel()); String name = pgStream.ReceiveString(); String value = pgStream.ReceiveString();
String errorMsg = pgStream.ReceiveString(); if (logger.logDebug()) logger.debug(" <=BE ErrorResponse(" + errorMsg + ")"); String warnMsg = pgStream.ReceiveString(); if (logger.logDebug()) logger.debug(" <=BE NoticeResponse(" + warnMsg + ")");
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; }
String name = pgStream.ReceiveString(); String value = pgStream.ReceiveString(); if (logger.logDebug()) logger.debug(" <=BE ParameterStatus(" + name + " = " + value + ")");
ServerErrorMessage errorMsg = new ServerErrorMessage(pgStream.ReceiveString(l_elen - 4), logger.getLogLevel()); if (logger.logDebug()) logger.debug(" <=BE ErrorMessage(" + errorMsg + ")");
String errorMsg = pgStream.ReceiveString(); if (logger.logDebug()) logger.debug(" <=BE ErrorMessage(" + errorMsg + ")");
ServerErrorMessage l_errorMsg = new ServerErrorMessage(pgStream.ReceiveString(l_elen - 4), logger.getLogLevel());
private SQLException receiveErrorMessage() throws IOException { String errorMsg = pgStream.ReceiveString().trim(); if (logger.logDebug()) logger.debug(" <=BE ErrorResponse(" + errorMsg + ")"); return new PSQLException(errorMsg, PSQLState.UNKNOWN_STATE); }
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)); }
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); }