/*
* <A NAME="bareCallStatement">baseCallStatement</A>
*/
final public StatementNode bareCallStatement() throws ParseException, StandardException {
ParameterNode returnParam;
ValueNode value;
ResultSetNode resultSetNode;
switch (jj_nt.kind) {
case CALL:
jj_consume_token(CALL);
value = primaryExpression(true);
if (! (value instanceof JavaToSQLValueNode) ||
! (((JavaToSQLValueNode) value).getJavaValueNode() instanceof MethodCallNode))
{
{if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
}
StatementNode callStatement =
(StatementNode) nodeFactory.getNode(
C_NodeTypes.CALL_STATEMENT_NODE,
value,
getContextManager());
setUpAndLinkParameters();
{if (true) return callStatement;}
break;
case QUESTION_MARK:
returnParam = dynamicParameterSpecification();
getCompilerContext().setReturnParameterFlag(); //bug4450
jj_consume_token(EQUALS_OPERATOR);
jj_consume_token(CALL);
resultSetNode = rowValueConstructor(null);
// validate that we have something that is an appropriate call statement
ResultColumnList rcl = resultSetNode.getResultColumns();
// we can have only 1 return value/column
if (rcl == null || rcl.size() > 1)
{
{if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
}
// we must have a method call node
value = ((ResultColumn) rcl.elementAt(0)).getExpression();
if (! (value instanceof JavaToSQLValueNode) ||
! (((JavaToSQLValueNode) value).getJavaValueNode() instanceof MethodCallNode))
{
{if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
}
// wrap the row result set in a cursor node
StatementNode cursorNode =
(StatementNode) nodeFactory.getNode(
C_NodeTypes.CURSOR_NODE,
"SELECT",
resultSetNode,
null,
null,
ReuseFactory.getInteger(CursorNode.READ_ONLY),
null,
getContextManager());
// set the 0th param to be a RETURN param
returnParam.setReturnOutputParam(value);
setUpAndLinkParameters();
{if (true) return cursorNode;}
break;