use of org.datanucleus.store.query.expression.ArrayExpression in project datanucleus-rdbms by datanucleus.
the class QueryToSQLMapper method getInvokedSqlExpressionForInvokeExpression.
protected SQLExpression getInvokedSqlExpressionForInvokeExpression(InvokeExpression expr) {
Expression invokedExpr = expr.getLeft();
SQLExpression invokedSqlExpr = null;
if (invokedExpr == null) {
// Static method
} else if (invokedExpr instanceof PrimaryExpression) {
processPrimaryExpression((PrimaryExpression) invokedExpr);
invokedSqlExpr = stack.pop();
} else if (invokedExpr instanceof Literal) {
processLiteral((Literal) invokedExpr);
invokedSqlExpr = stack.pop();
} else if (invokedExpr instanceof ParameterExpression) {
// TODO May be needed to set the second parameter to "false" here and then if the method
// being invoked needs the parameters as a normal SQLLiteral then allow it to convert it itself
processParameterExpression((ParameterExpression) invokedExpr, true);
invokedSqlExpr = stack.pop();
} else if (invokedExpr instanceof InvokeExpression) {
processInvokeExpression((InvokeExpression) invokedExpr);
invokedSqlExpr = stack.pop();
} else if (invokedExpr instanceof VariableExpression) {
processVariableExpression((VariableExpression) invokedExpr);
invokedSqlExpr = stack.pop();
} else if (invokedExpr instanceof ArrayExpression) {
ArrayExpression arrExpr = (ArrayExpression) invokedExpr;
SQLExpression[] arrSqlExprs = new SQLExpression[arrExpr.getArraySize()];
for (int i = 0; i < arrExpr.getArraySize(); i++) {
Expression arrElemExpr = arrExpr.getElement(i);
arrElemExpr.evaluate(this);
arrSqlExprs[i] = stack.pop();
}
JavaTypeMapping m = exprFactory.getMappingForType(Object[].class, false);
invokedSqlExpr = new org.datanucleus.store.rdbms.sql.expression.ArrayExpression(stmt, m, arrSqlExprs);
} else if (invokedExpr instanceof DyadicExpression) {
DyadicExpression dyExpr = (DyadicExpression) invokedExpr;
dyExpr.evaluate(this);
invokedSqlExpr = stack.pop();
} else {
throw new NucleusException("Dont currently support invoke expression " + invokedExpr);
}
return invokedSqlExpr;
}
Aggregations