private Notice parseNotice(ByteBuf buffer) {
Context context = getContext();
Notice notice = new Notice();
byte msgId;
while ((msgId = buffer.readByte()) != 0) {
switch (msgId) {
case 'S':
notice.setSeverity(readCString(buffer, context.getCharset()));
break;
case 'C':
notice.setCode(readCString(buffer, context.getCharset()));
break;
case 'M':
notice.setMessage(readCString(buffer, context.getCharset()));
break;
case 'D':
notice.setDetail(readCString(buffer, context.getCharset()));
break;
case 'H':
notice.setHint(readCString(buffer, context.getCharset()));
break;
case 'P':
notice.setPosition(readCString(buffer, context.getCharset()));
break;
case 'W':
notice.setWhere(readCString(buffer, context.getCharset()));
break;
case 'F':
notice.setFile(readCString(buffer, context.getCharset()));
break;
case 'L':
notice.setLine(readCString(buffer, context.getCharset()));
break;
case 'R':
notice.setRoutine(readCString(buffer, context.getCharset()));
break;
case 's':
notice.setSchema(readCString(buffer, context.getCharset()));
break;
case 't':
notice.setTable(readCString(buffer, context.getCharset()));
break;
case 'c':
notice.setColumn(readCString(buffer, context.getCharset()));
break;
case 'd':
notice.setDatatype(readCString(buffer, context.getCharset()));
break;
case 'n':
notice.setConstraint(readCString(buffer, context.getCharset()));
break;
default:
// Read and ignore
readCString(buffer, context.getCharset());