Expression[] updateExprs = compilation.getExprUpdate();
SQLExpression[] updateSqlExprs = new SQLExpression[updateExprs.length];
for (int i=0;i<updateExprs.length;i++)
{
// "field = value"
DyadicExpression updateExpr = (DyadicExpression)updateExprs[i];
// Left-side has to be PrimaryExpression
SQLExpression leftSqlExpr = null;
if (updateExpr.getLeft() instanceof PrimaryExpression)
{
processPrimaryExpression((PrimaryExpression)updateExpr.getLeft());
leftSqlExpr = stack.pop();
}
else
{
throw new NucleusException("Dont currently support update clause containing left expression of type " + updateExpr.getLeft());
}
// Right-side can be Literal, or Parameter, or PrimaryExpression
SQLExpression rightSqlExpr = null;
if (updateExpr.getRight() instanceof Literal)
{
processLiteral((Literal)updateExpr.getRight());
rightSqlExpr = stack.pop();
}
else if (updateExpr.getRight() instanceof ParameterExpression)
{
processParameterExpression((ParameterExpression)updateExpr.getRight());
rightSqlExpr = stack.pop();
}
else if (updateExpr.getRight() instanceof PrimaryExpression)
{
processPrimaryExpression((PrimaryExpression)updateExpr.getRight());
rightSqlExpr = stack.pop();
}
else if (updateExpr.getRight() instanceof DyadicExpression)
{
updateExpr.getRight().evaluate(this);
rightSqlExpr = stack.pop();
}
else if (updateExpr.getRight() instanceof CaseExpression)
{
updateExpr.getRight().evaluate(this);
rightSqlExpr = stack.pop();
}
else
{
throw new NucleusException("Dont currently support update clause containing right expression of type " + updateExpr.getRight());
}
if (leftSqlExpr != null && rightSqlExpr != null)
{
updateSqlExprs[i] = leftSqlExpr.eq(rightSqlExpr);