use of org.firebirdsql.gds.impl.wire.XdrInputStream in project jaybird by FirebirdSQL.
the class AbstractWireOperations method readStatusVector.
@Override
public final SQLException readStatusVector() throws SQLException {
boolean debug = log.isDebugEnabled();
final FbExceptionBuilder builder = new FbExceptionBuilder();
final XdrInputStream xdrIn = getXdrIn();
try {
while (true) {
int arg = xdrIn.readInt();
int errorCode;
switch(arg) {
case isc_arg_gds:
errorCode = xdrIn.readInt();
if (debug)
log.debug("readStatusVector arg:isc_arg_gds int: " + errorCode);
if (errorCode != 0) {
builder.exception(errorCode);
}
break;
case isc_arg_warning:
errorCode = xdrIn.readInt();
if (debug)
log.debug("readStatusVector arg:isc_arg_warning int: " + errorCode);
if (errorCode != 0) {
builder.warning(errorCode);
}
break;
case isc_arg_interpreted:
case isc_arg_string:
String stringValue = xdrIn.readString(getEncoding());
if (debug)
log.debug("readStatusVector string: " + stringValue);
builder.messageParameter(stringValue);
break;
case isc_arg_sql_state:
String sqlState = xdrIn.readString(getEncoding());
if (debug)
log.debug("readStatusVector sqlstate: " + sqlState);
builder.sqlState(sqlState);
break;
case isc_arg_number:
int intValue = xdrIn.readInt();
if (debug)
log.debug("readStatusVector arg:isc_arg_number int: " + intValue);
builder.messageParameter(intValue);
break;
case isc_arg_end:
if (builder.isEmpty()) {
return null;
}
return builder.toFlatSQLException();
default:
int e = xdrIn.readInt();
if (debug)
log.debug("readStatusVector arg: " + arg + " int: " + e);
builder.messageParameter(e);
break;
}
}
} catch (IOException ioe) {
throw new FbExceptionBuilder().exception(ISCConstants.isc_net_read_err).cause(ioe).toSQLException();
}
}
Aggregations