int holdType = theConnection.getHoldability();
QualifiedIdentifier qi;
Statement st = null;
String sVal;
ResultSet rs = null;
SQLWarning warns;
jj_consume_token(GET);
if (jj_2_99(2)) {
scrolling = jj_consume_token(SCROLL);
scrollType = scrollType();
} else {
;
}
if (jj_2_100(2)) {
withtoken = jj_consume_token(WITH);
holdType = holdType();
} else {
;
}
jj_consume_token(CURSOR);
qi = qualifiedIdentifier();
jj_consume_token(AS);
s = jj_consume_token(STRING);
sVal = stringValue(s.image);
try {
Session sn = findSession(qi.getSessionName());
st = sn.getConnection().createStatement(
scrollType, ResultSet.CONCUR_READ_ONLY, holdType);
JDBCDisplayUtil.checkNotNull(st,"cursor");
st.setCursorName(qi.getLocalName());
rs = st.executeQuery(sVal);
JDBCDisplayUtil.checkNotNull(rs,"cursor");
sn.addCursorStatement(qi.getLocalName(),st);
sn.addCursor(qi.getLocalName(),rs);
} catch (SQLException e) {
if (rs!=null) rs.close();
if (st!=null) st.close();
{if (true) throw e;}
}
// all we want callers to see are the warnings.
SQLWarning w1 = theConnection.getWarnings();
SQLWarning w2 = st.getWarnings();
SQLWarning w3 = rs.getWarnings();
theConnection.clearWarnings();
st.clearWarnings();
rs.clearWarnings();
warns = appendWarnings(w1,w2);
{if (true) return new ijWarningResult(appendWarnings(warns,w3));}