return super.staticMethodCallValue(val, in);
}
@Override public SQLColumnValues virtualMethodCallValue(MethodCallValue.VirtualMethodCallValue val, T in) throws TypedValueVisitorException
{
MethodSignature sig = val.getSignature();
if (TransformationClassAnalyzer.stringEquals.equals(sig))
{
assert(false); // This should never happen because the simplifier should eliminate these
SQLColumnValues sql = new SQLColumnValues(new SQLReader.BooleanSQLReader());
sql.add("(");
sql.add(val.base.visit(this, in));
sql.add(")");
sql.add(" = ");
sql.add("(");
sql.add(val.args.get(0).visit(this, in));
sql.add(")");
return sql;
}
else if (TransformationClassAnalyzer.newPair.equals(sig)
|| TransformationClassAnalyzer.newTuple3.equals(sig)
|| TransformationClassAnalyzer.newTuple4.equals(sig)
|| TransformationClassAnalyzer.newTuple5.equals(sig)
|| TransformationClassAnalyzer.newTuple8.equals(sig))
{
SQLColumnValues [] vals = new SQLColumnValues[val.args.size()];
for (int n = 0; n < vals.length; n++)
vals[n] = val.args.get(n).visit(this, in);
SQLReader [] valReaders = new SQLReader[vals.length];
for (int n = 0; n < vals.length; n++)
valReaders[n] = vals[n].reader;
SQLColumnValues sql = new SQLColumnValues(SQLReader.TupleSQLReader.createReaderForTuple(sig.owner, valReaders));
int offset = 0;
for (int n = 0; n < vals.length; n++)
{
for (int col = 0; col < vals[n].columns.length; col++)
{
sql.columns[offset] = vals[n].columns[col];
offset++;
}
}
return sql;
}
else if (entityInfo.fieldMethods.containsKey(sig))
{
String fieldName = entityInfo.fieldMethods.get(sig);
SQLColumnValues base = val.base.visit(this, in);
SQLColumnValues sql = new SQLColumnValues(base.reader.getReaderForField(fieldName));
for (int n = 0; n < sql.reader.getNumColumns(); n++)
sql.columns[n] = base.columns[base.reader.getColumnForField(fieldName) + n];
return sql;
}
else if (entityInfo.passThroughMethods.contains(sig))
{
SQLColumnValues base = val.base.visit(this, in);
return base;
}
else if (entityInfo.dbSetMethods.contains(sig))
{
if (lambdaContext.joins == null)
throw new TypedValueVisitorException("Need a join handler here for subqueries just in case there's an embedded navigational query: " + val);
// TODO: Handle checking out the constructor and verifying how
// parameters pass through the constructor
SQLQuery subQuery = val.base.visit(subQueryHandler, in);
if (sig.equals(TransformationClassAnalyzer.dbsetSumInt)
|| sig.equals(TransformationClassAnalyzer.dbsetMaxInt))
{
// TODO: do subqueries need to be copied before being passed in here?
SQLQuery<Integer> newQuery = null;
if (sig.equals(TransformationClassAnalyzer.dbsetSumInt))
newQuery = queryMethodHandler.sumInt(subQuery, val.args.get(0), lambdaContext.joins.getEntityManager());
else if (sig.equals(TransformationClassAnalyzer.dbsetMaxInt))
newQuery = queryMethodHandler.maxInt(subQuery, val.args.get(0), lambdaContext.joins.getEntityManager());
if (newQuery == null) throw new TypedValueVisitorException("Could not decode a subquery " + val);
if (newQuery instanceof SQLQuery.InternalGroup)
{
SQLQuery.InternalGroup<Integer> agg = (SQLQuery.InternalGroup<Integer>)newQuery;